T
Terry Burns
I have two data adapters and tables (people and events ). The People have a
unique key and the Events also. In the Events the ID fiels corresponds with
the ID PKEY of the People.
Basically, when you initialise this, the People grid fills but the Events do
not fill with the matching ID rows.
Help would be great - Terry
Sub initialiseDataConnectivity()
Dim cmd As New OleDbCommand
' set connection string
con.ConnectionString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet
OLEDB:Registry Path=;Jet OLEDBatabase L" & _
"ocking Mode=1;Data Source=""C:\Documents and Settings\Administrator\My
Documents\" & _
"FamilyPlusFriends.mdb"";Jet OLEDB:Engine
Type=5;Provider=""Microsoft.Jet.OLEDB.4.0" & _
""";Jet OLEDB:System database=;Jet OLEDB:SFP=False;persist security
info=False;Ext" & _
"ended Properties=;Mode=Share Deny None;Jet OLEDB:Encrypt Database=False;Jet
OLED" & _
"B:Create System Database=False;Jet OLEDBon't Copy Locale on
Compact=False;Jet " & _
"OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Global
Bulk T" & _
"ransactions=1"
'open connection
con.Open()
'Initialise People
dgPeople.DataSource = tablePeople
cmd.CommandText = "SELECT ID,FirstName,LastName,DOB,[Mobile Fone],[Home
Phone],Email, Address1, Address2,Address3, Address4,Town, [Post Code],
County, Country,MiddleInnitial FROM(People)ORDER BY FirstName"
cmd.CommandType = CommandType.Text
cmd.Connection = con
daEvents.SelectCommand = cmd
daEvents.Fill(tablePeople)
'Initialise Events
dgEvents.DataSource = tableEvents
cmd.CommandType = CommandType.Text
cmd.CommandText = "SELECT * FROM Events WHERE id=?"
cmd.Connection = con
cmd.Parameters.Add("@ID", OleDbType.Integer).Value =
dgPeople.Item(dgPeople.CurrentRowIndex, 0)
daEvents.SelectCommand = cmd
daEvents.Fill(tableEvents)
'Close connection
con.Close()
unique key and the Events also. In the Events the ID fiels corresponds with
the ID PKEY of the People.
Basically, when you initialise this, the People grid fills but the Events do
not fill with the matching ID rows.
Help would be great - Terry
Sub initialiseDataConnectivity()
Dim cmd As New OleDbCommand
' set connection string
con.ConnectionString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet
OLEDB:Registry Path=;Jet OLEDBatabase L" & _
"ocking Mode=1;Data Source=""C:\Documents and Settings\Administrator\My
Documents\" & _
"FamilyPlusFriends.mdb"";Jet OLEDB:Engine
Type=5;Provider=""Microsoft.Jet.OLEDB.4.0" & _
""";Jet OLEDB:System database=;Jet OLEDB:SFP=False;persist security
info=False;Ext" & _
"ended Properties=;Mode=Share Deny None;Jet OLEDB:Encrypt Database=False;Jet
OLED" & _
"B:Create System Database=False;Jet OLEDBon't Copy Locale on
Compact=False;Jet " & _
"OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Global
Bulk T" & _
"ransactions=1"
'open connection
con.Open()
'Initialise People
dgPeople.DataSource = tablePeople
cmd.CommandText = "SELECT ID,FirstName,LastName,DOB,[Mobile Fone],[Home
Phone],Email, Address1, Address2,Address3, Address4,Town, [Post Code],
County, Country,MiddleInnitial FROM(People)ORDER BY FirstName"
cmd.CommandType = CommandType.Text
cmd.Connection = con
daEvents.SelectCommand = cmd
daEvents.Fill(tablePeople)
'Initialise Events
dgEvents.DataSource = tableEvents
cmd.CommandType = CommandType.Text
cmd.CommandText = "SELECT * FROM Events WHERE id=?"
cmd.Connection = con
cmd.Parameters.Add("@ID", OleDbType.Integer).Value =
dgPeople.Item(dgPeople.CurrentRowIndex, 0)
daEvents.SelectCommand = cmd
daEvents.Fill(tableEvents)
'Close connection
con.Close()