1. With ODBC Connection.
string filepath = "c:\\nn\\";
OdbcConnection CC = new OdbcConnection("Driver={Microsoft dBase Driver (*.dbf)};SourceType=DBF;SourceDB=" + filepath + ";Exclusive=No; Collate=Machine;NULL=NO;DELETED=NO;BACKGROUNDFETCH=NO;");
CC.Open();
OdbcCommand cmd = new OdbcCommand("Select * From " + filepath + "smsout.dbf" , CC);
OdbcDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
DataTable dt = new DataTable();
dt.Load(dr);
}
CC.Close();
2. With OLEDB Connection.
OleDbConnection ccc = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath.Substring(0, filepath.LastIndexOf("\\")) + ";Extended Properties=dBASE IV;");
ccc.Open();
OleDbCommand cmd1 = new OleDbCommand("Select * From " + filepath + "smsout.dbf", ccc);
OleDbDataReader dr1 = cmd1.ExecuteReader();
if (dr1.HasRows)
{
DataTable dt1 = new DataTable();
dt1.Load(dr1);
}
ccc.Close();
OdbcCommand cmd = new OdbcCommand("Select * From " + filepath + "smsout.dbf" , CC);
OdbcDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
DataTable dt = new DataTable();
dt.Load(dr);
}
CC.Close();
2. With OLEDB Connection.
OleDbConnection ccc = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath.Substring(0, filepath.LastIndexOf("\\")) + ";Extended Properties=dBASE IV;");
ccc.Open();
OleDbCommand cmd1 = new OleDbCommand("Select * From " + filepath + "smsout.dbf", ccc);
OleDbDataReader dr1 = cmd1.ExecuteReader();
if (dr1.HasRows)
{
DataTable dt1 = new DataTable();
dt1.Load(dr1);
}
ccc.Close();