S
steve
Hello,
Can anybosy guide me to the right direction to synchronize two controls from two different tables?
Both tables have been filled to the dataset by two separate adapters, the controls have been bound to different fields in the two tables and everything is nice, except that the controls are NOT synchronized.
They are independent. i.e. if you scroll on one list the other doesnt change accoringly and vice versa.
The two tables have (in the original database) a parent-child relationship with a foreign key. Do the two rtables have to be of equal size ?????
The important part of the code is below,
Am i missing something?
Thanx in advance!
steve
---------------------------------------------------------------------------------------------------------------------------------
Dim strDBConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
& "C:\RAFALE\Beta\BD\Rafalebd.mdb"
Dim DBConnection As OleDbConnection = New OleDbConnection(strDBConnection)
DBConnection.Open()
''''' First string and adapter
Dim strSelectQA1 As String = "SELECT * FROM tblInfoQA "
'SQL Data Adapter !!!
Dim DBAdapterQA As OleDbDataAdapter = New OleDbDataAdapter(strSelectQA1, DBConnection)
Dim DS As New DataSet
DS.EnforceConstraints = False
DBAdapterQA.Fill(DS, "tblInfoQA")
''''' Second string and adapter
Dim strSelectQA2 As String = "SELECT * FROM tblQAHor"
DBAdapterQA = New OleDbDataAdapter(strSelectQA2, DBConnection)
DBAdapterQA.Fill(DS, "tblQAHor")
DS.EnforceConstraints = True
DBConnection.Close()
'Relation
DS.Relations.Add("experiment2", _
DS.Tables("tblInfoQA").Columns("MENVid"), _
DS.Tables("tblQAHor").Columns("MENVid"))
'********** CONTROLS ***********
cmb1.DataSource = DS
cmb1.DisplayMember = "tblInfoQA.MENVid"
cmb2.DataSource = DS
cmb2.DisplayMember = "tblInfoQA.O3"
lbl1.DataBindings.Clear()
lbl1.DataBindings.Add("text", DS, "tblQAHor.NO")
'*********************
------------------------------------------------------------------------------------------------------------------------------
Can anybosy guide me to the right direction to synchronize two controls from two different tables?
Both tables have been filled to the dataset by two separate adapters, the controls have been bound to different fields in the two tables and everything is nice, except that the controls are NOT synchronized.
They are independent. i.e. if you scroll on one list the other doesnt change accoringly and vice versa.
The two tables have (in the original database) a parent-child relationship with a foreign key. Do the two rtables have to be of equal size ?????
The important part of the code is below,
Am i missing something?
Thanx in advance!
steve
---------------------------------------------------------------------------------------------------------------------------------
Dim strDBConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
& "C:\RAFALE\Beta\BD\Rafalebd.mdb"
Dim DBConnection As OleDbConnection = New OleDbConnection(strDBConnection)
DBConnection.Open()
''''' First string and adapter
Dim strSelectQA1 As String = "SELECT * FROM tblInfoQA "
'SQL Data Adapter !!!
Dim DBAdapterQA As OleDbDataAdapter = New OleDbDataAdapter(strSelectQA1, DBConnection)
Dim DS As New DataSet
DS.EnforceConstraints = False
DBAdapterQA.Fill(DS, "tblInfoQA")
''''' Second string and adapter
Dim strSelectQA2 As String = "SELECT * FROM tblQAHor"
DBAdapterQA = New OleDbDataAdapter(strSelectQA2, DBConnection)
DBAdapterQA.Fill(DS, "tblQAHor")
DS.EnforceConstraints = True
DBConnection.Close()
'Relation
DS.Relations.Add("experiment2", _
DS.Tables("tblInfoQA").Columns("MENVid"), _
DS.Tables("tblQAHor").Columns("MENVid"))
'********** CONTROLS ***********
cmb1.DataSource = DS
cmb1.DisplayMember = "tblInfoQA.MENVid"
cmb2.DataSource = DS
cmb2.DisplayMember = "tblInfoQA.O3"
lbl1.DataBindings.Clear()
lbl1.DataBindings.Add("text", DS, "tblQAHor.NO")
'*********************
------------------------------------------------------------------------------------------------------------------------------