OleDbConnection con;
OleDbCommand cmd;
OleDbDataReader reader;
con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=D:\\SampleDB.mdb;" + "Jet OLEDB:Engine Type=5");
con.Open();
cmd = new OleDbCommand("SELECT * from Table1", con);
reader = cmd.ExecuteReader();
int iColumns = reader.VisibleFieldCount;
for (int x = 0; x < iColumns; x++)
{
listBox1.Items.Add(reader.GetName(x));
}
con.Close();
Wednesday, February 3, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment