[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

Error: Database or object is read-only

Boro

4/25/2009 8:05:00 AM

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!
1 Answer

Boro

4/25/2009 5:51:00 PM

0

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()



"Boro" wrote:

> 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!