المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Multiple tables from a single DB



C# Programming
04-29-2009, 08:51 PM
There seems to be a problem with my code when I try and retrieve multiple tables. Please tell me what's wrong, or if there is an alternative way to do this? Thanks in advance.

OleDbConnection clsConnection;
clsConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\one.mdb;");
clsConnection.Open();
//first table
WTest1.oneDataSet f_table = new WTest1.oneDataSet();
OleDbDataAdapter dAdapter = new OleDbDataAdapter("SELECT * FROM first", clsConnection);
dAdapter.Fill(f_table, "first");

//second table
WTest1.oneDataSet s_table = new WTest1.oneDataSet();
OleDbDataAdapter dAdapter1 = new OleDbDataAdapter("SELECT * FROM second", clsConnection);
dAdapter1.Fill(s_table, "second");

--Star