Hi Folks.
I have some questions regarding tableadapters an dataadapters.
Up until now, I have been using oleDbDataAdapters as shown below. This is before tableadapters were available.
I have tried to repeat the code using a tableadapter - created by using the 'add datasource' option in project explorer - and want to change the select statement in code. However, I cannot see how this is done.
Is it possible to change the select statement in a table adapter using code?
The follow on from this is whether my original method - using the OLEDbDataAdapter - is 'old' or whether it is, in fact, the best approach.
Thanks for your comments!
Paul
OleDbDataAdapter method:
------------------------
Public daDetails As New OleDbDataAdapter()
Public cnDetails As New OleDbConnection()
Public WithEvents comSelDetails As New OleDbCommand()
Public WithEvents comInsDetails As New OleDbCommand()
Public WithEvents comUpdDetails As New OleDbCommand()
Public WithEvents comDelDetails As New OleDbCommand()
comSelDetails.CommandText = "Select * from tblDetails"
comSelDetails.Connection = cnDetails
daDetails.UpdateCommand = comUpdDetails
daDetails.DeleteCommand = comDelDetails
daDetails.InsertCommand = comInsDetails
daDetails.SelectCommand = comSelDetails
My table adapter declarations:
------------------------------
Public dsCardFile As New CardFileDataSet
Public taDetails As New CardFileDataSetTableAdapters.DetailsTableAdapter
Public tblDetails As New CardFileDataSet.DetailsDataTable
I have some questions regarding tableadapters an dataadapters.
Up until now, I have been using oleDbDataAdapters as shown below. This is before tableadapters were available.
I have tried to repeat the code using a tableadapter - created by using the 'add datasource' option in project explorer - and want to change the select statement in code. However, I cannot see how this is done.
Is it possible to change the select statement in a table adapter using code?
The follow on from this is whether my original method - using the OLEDbDataAdapter - is 'old' or whether it is, in fact, the best approach.
Thanks for your comments!
Paul
OleDbDataAdapter method:
------------------------
Public daDetails As New OleDbDataAdapter()
Public cnDetails As New OleDbConnection()
Public WithEvents comSelDetails As New OleDbCommand()
Public WithEvents comInsDetails As New OleDbCommand()
Public WithEvents comUpdDetails As New OleDbCommand()
Public WithEvents comDelDetails As New OleDbCommand()
comSelDetails.CommandText = "Select * from tblDetails"
comSelDetails.Connection = cnDetails
daDetails.UpdateCommand = comUpdDetails
daDetails.DeleteCommand = comDelDetails
daDetails.InsertCommand = comInsDetails
daDetails.SelectCommand = comSelDetails
My table adapter declarations:
------------------------------
Public dsCardFile As New CardFileDataSet
Public taDetails As New CardFileDataSetTableAdapters.DetailsTableAdapter
Public tblDetails As New CardFileDataSet.DetailsDataTable