khadem1386 Posted November 18, 2007 Share Posted November 18, 2007 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 More sharing options...
Reg Edit Posted November 18, 2007 Share Posted November 18, 2007 The DataAdapter's Fill method is overloaded. You can just fill a DataTable: MyDataAdapter.Fill(MyTable) So you can use this overload to fill the individual tables you have in your DataSet. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.