OleDBDataReader and OleDBCommand returns empty value

  • Thread starter Thread starter viknes82
  • Start date Start date
V

viknes82

Guest
Good day,

We have recently migrated our application from Visual Basic 6 to C# .NET architecture. Our application uses MS Access 97 .mdb to store data. The migrated C# .NET application is deployed on Windows 10 Pro 64-bit and we noticed the DataTable has empty record when selecting from the mdb database intermittently.

The code snippet of selecting the record as below.

string sqlQuery = "Select statement is here";

string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= mdbPath_here;Persist Security Info=False;"

DataTable dataTable = new DataTable();

OleDBConnection connection = new OleDBConnection(connectionString);

connection.Open()

OleDBDataReader dataReader;

using (OleDbCommand command = new OleDbCommand(sqlquery, connection))

{

command.CommandTimeout = commandTimeout;

dataReader = command.ExecuteReader();

dataTable.Load(dataReader);

}

dataTable.Rows.Count; -> the value here is 0

Is there something that we had overlooked to handle the DB reading using OleDBDataReader and OleDBCommand?

Please advise.

Thank You.

Continue reading...
 
Back
Top