Jump to content

How Can I fill a dataSet with tow or more Table?


khadem1386

Recommended Posts

Hi to allThis is My code that set DataSet with one table.

MyConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("App_Data/barnameHaftegi1.mdb"))		' Create a Command object with the SQL statement.		sqlstr = "SELECT * FROM barname				MyCommand = New OleDbDataAdapter(sqlstr, MyConnection)	  ' Fill a DataSet with data returned from the database.	  MyDataset = New Data.DataSet		MyCommand.Fill(MyDataset)		'LoadDataSet(MyDataset)	  ' Create a new DataTable object and assign to it	  ' the new table in the Tables collection.	  MyTable = New Data.DataTable		MyTable = MyDataset.Tables(0)

Barname is my table name but I have anothetr table in my DB Such Dayweek,Calss,SubjectI want use for example MyTable = MyDataset.Tables(2)Can I use a sqlstr that it containe tow or more table.or can I use such this?

  myDataSet.Fields.Add("Subject")

I want a dataset with to tables or more.Thanks

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...