Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TableAdapters and DataAdapters

Status
Not open for further replies.

NatHunter

Technical User
Aug 17, 2001
51
0
0
GB
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top