Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error: Database or object is read-only

1 view
Skip to first unread message

Boro

unread,
Apr 25, 2009, 4:05:01 AM4/25/09
to
I am getting the following error when trying to read data from a | delimited
file using .Net 3.5 console application and Microsoft Text Driver.

string path = "C:\MyPath\";
string query = "SELECT * FROM MyFile.txt";

OdbcConnection myConn = new OdbcConnection("Driver={Microsoft Text Driver
(*.txt; *.csv)};Dbq=" + path + ;Extensions=asc,csv,tab,txt;");

OdbcCommand cmd = new OdbcCommand(query, myConn);
myConn.Open();

OdbcDataReader rd = cmd.ExecuteReader();

I tryed OleDb and Jet4.0 with same results, just a different error.

The above code works fine on my machine with Vista Ultimate and VS 2008.
When I move the app to the testing or production servers (both Win 2003) it
fails.

Hope someone will have solution for my problem.
Thanks!

Boro

unread,
Apr 25, 2009, 1:51:01 PM4/25/09
to
Oops! Here is the error:

ERROR [42000] [Microsoft][ODBC Text Driver] Cannot update. Database or
object is read-only.
at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle,
RetCode retcode)
at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior
behavior, String method, Boolean needReader, Object[] methodArguments,
SQL_API odbcApiMethod)
at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior
behavior, String method, Boolean needReader)
at System.Data.Odbc.OdbcCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Odbc.OdbcCommand.ExecuteReader()

0 new messages