C
Chris Kettenbach
Hi All,
Quick question. Can I use more than two tables as a source for a dataset? I
am trying to fill a dataadpater but when I include more than two tables, it
bombs out. Example:
________________________________________________________
This works
cmd = New OleDbCommand("SELECT FirstName, LastName " & _
"FROM (Event_Registration INNER JOIN Employees ON " & _
"Event_Registration.EmployeeID = Employees.EmployeeID) " & _
"WHERE EventID=?", cn)
Dim param As OleDbParameter
Dim ds As New DataSet
ds.DataSetName = "Registrations"
For Each param In p
cmd.Parameters.Add(param)
Next
Dim adptr As OleDbDataAdapter = New OleDbDataAdapter(cmd)
adptr.Fill(ds, "Event") This fails
_________________________________________________________________
This fails
cmd = New OleDbCommand("SELECT FirstName, LastName " & _
"FROM (Event_Registration INNER JOIN Employees ON " & _
"Event_Registration.EmployeeID = Employees.EmployeeID) " & _
"INNER JOIN [Names] ON Employees.NameID = Names.NameID WHERE EventID=?", cn)
Dim param As OleDbParameter
Dim ds As New DataSet
ds.DataSetName = "Registrations"
For Each param In p
cmd.Parameters.Add(param)
Next
Dim adptr As OleDbDataAdapter = New OleDbDataAdapter(cmd)
adptr.Fill(ds, "Event") '<~~~ fails here when join has more than two tables
_________________________________________________________________
Any suggestions? Am I doing something wrong? Thanks Everybody!!!
Chris
Quick question. Can I use more than two tables as a source for a dataset? I
am trying to fill a dataadpater but when I include more than two tables, it
bombs out. Example:
________________________________________________________
This works
cmd = New OleDbCommand("SELECT FirstName, LastName " & _
"FROM (Event_Registration INNER JOIN Employees ON " & _
"Event_Registration.EmployeeID = Employees.EmployeeID) " & _
"WHERE EventID=?", cn)
Dim param As OleDbParameter
Dim ds As New DataSet
ds.DataSetName = "Registrations"
For Each param In p
cmd.Parameters.Add(param)
Next
Dim adptr As OleDbDataAdapter = New OleDbDataAdapter(cmd)
adptr.Fill(ds, "Event") This fails
_________________________________________________________________
This fails
cmd = New OleDbCommand("SELECT FirstName, LastName " & _
"FROM (Event_Registration INNER JOIN Employees ON " & _
"Event_Registration.EmployeeID = Employees.EmployeeID) " & _
"INNER JOIN [Names] ON Employees.NameID = Names.NameID WHERE EventID=?", cn)
Dim param As OleDbParameter
Dim ds As New DataSet
ds.DataSetName = "Registrations"
For Each param In p
cmd.Parameters.Add(param)
Next
Dim adptr As OleDbDataAdapter = New OleDbDataAdapter(cmd)
adptr.Fill(ds, "Event") '<~~~ fails here when join has more than two tables
_________________________________________________________________
Any suggestions? Am I doing something wrong? Thanks Everybody!!!
Chris