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

Error: Database or object is read-only

102 views
Skip to first unread message

Boro

unread,
Apr 25, 2009, 4:02: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:50:05 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()

Pak-Ming Cheung - MSFT

unread,
May 6, 2009, 4:32:01 AM5/6/09
to
From your description, it seems that it works on Vista but not on Win2K3.
I have talked to the JET team (who owns the Text driver). They said that
there is basically no differences between Win2k3 and Vista, if you install
all related bulletins and service packs on Win2k3.

Thanks,
Ming.
WDAC Team, Microsoft.

P.S. We recommend customers to use the forum to ask questions in the future,
where you can obtain a faster response (Forum is at:
http://social.msdn.microsoft.com/forums/en-US/sqldataaccess/threads/)

0 new messages