I want to receive the data as a string array at once in Oledbcommand.
I will not use this Datatable, DataSet method.
I will not use this OleDbDataReader method.
I will not use this Datatable, DataSet method.
I will not use this OleDbDataReader method.
C#:
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\data\myDB.mdb";
string strSQL = "SELECT LastName From User";
OleDbConnection conn = new OleDbConnection(strConn);
OleDbCommand comm = new OleDbComand(strSQL, conn);
try
{
conn.Open();
OleDbDataReader reader = comm.ExcuteReader();
while(reader.Read() == true)
{
Console.WriteLine(reader["LastName"] + " " + reader["Age"]);
}
reader.Close();
conn.Close();
}
catch (Exception e)
{
Console.WriteLine(" DB Open Fail ")l
}
Last edited by a moderator: