MSDASQL/SQLServer ODBC' provider is not registered on the local machine"
I want to open dbf file and read data. DBF file data is having wide chars. try to open connection, It encountered exception: "The 'MSDASQL/SQLServer ODBC' provider is not registered on the local machine"
Sample code
string constring = @"Provider=MSDASQL/SQLServer ODBC;Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=C:\Users\Temp\Desktop\WpfApp1";
using (OleDbConnection con = new OleDbConnection(constring))
{
var sql = "select *from PRINFO.DBF";
using (OleDbCommand cmd = new OleDbCommand(sql, con))
{ try
{ con.Open();
using (OleDbDataAdapter dataAdapter = new OleDbDataAdapter(cmd))
{ //... }
}
catch (Exception ex)
{ string message = ex.Message; }
} con.Close();
}
If i try to open connection from OdbcConnection. It encountered exception:ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified”
Sample code:
string constr = @"Provider=MSDASQL/SQLServer ODBC;Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=C:\Users\esa446387\Desktop\WpfApp1\PRINFO.DBF";
using (OdbcConnection con = new OdbcConnection(constr))
{ try
{
OdbcCommand cmd = new OdbcCommand();
OdbcDataReader myReader;
cmd.Connection = con;
con.Open();
myReader = cmd.ExecuteReader();
con.Close();
}
catch (Exception ex)
{
string message = ex.Message;
}
Please let us know what driver do i need to install, how can i check and fix MSDASQL/SQLServer ODBC' provider is not registered on the local machine"