T
TF
Hi,
I have to access data from a comma delimited file in .net windows
application (VB.net or C#). I am using Microsoft.Jet.OLEDB.4.0
provider for this purpose. Now the problem is when i extract data from
a file with extension csv or txt it works fine but as soon as i change
the extension, like 'log' or 'abc' it gives following error in 'Fill'
function of 'OleDbDataAdapter':
Cannot update. Database or object is read-only
I've added file entry in 'schema.ini' file, also I've created a dummy
System DSN and added new extension 'log' in it, but no success.
Here is the code:
//--------------------------------------------
string strConString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\data\\; Extended Properties=\"Text;HDR=YES;\"";
// open connection
OleDbConnection oCon = new OleDbConnection(strConString);
oCon.Open();
// fill data set
string strSql = "SELECT * FROM datafile.txt";
OleDbDataAdapter oDA = new OleDbDataAdapter( strSql, oCon );
DataSet oData = new DataSet();
oDA.Fill( oData, datafile.txt ); // -- error if file extension is
log
oCon.Close();
//---------------------------------------------
Any help??
TF
I have to access data from a comma delimited file in .net windows
application (VB.net or C#). I am using Microsoft.Jet.OLEDB.4.0
provider for this purpose. Now the problem is when i extract data from
a file with extension csv or txt it works fine but as soon as i change
the extension, like 'log' or 'abc' it gives following error in 'Fill'
function of 'OleDbDataAdapter':
Cannot update. Database or object is read-only
I've added file entry in 'schema.ini' file, also I've created a dummy
System DSN and added new extension 'log' in it, but no success.
Here is the code:
//--------------------------------------------
string strConString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\data\\; Extended Properties=\"Text;HDR=YES;\"";
// open connection
OleDbConnection oCon = new OleDbConnection(strConString);
oCon.Open();
// fill data set
string strSql = "SELECT * FROM datafile.txt";
OleDbDataAdapter oDA = new OleDbDataAdapter( strSql, oCon );
DataSet oData = new DataSet();
oDA.Fill( oData, datafile.txt ); // -- error if file extension is
log
oCon.Close();
//---------------------------------------------
Any help??
TF