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