I am trying to apply this query on an Access database :
OleDbConnection acessConn = database.con_accessa_m(acessdbs[i]);
string acessquery = "SELECT LTRIM(MID([Owner], 1, INSTR( [Owner],'/')-1)) AS 'lastname',IIf( INSTR( LTRIM(MID([Owner], INSTR( [Owner], '/')+1)), '/')>0,LTRIM(MID(LTRIM(MID([Owner], INSTR( [Owner], '/')+1)),1,INSTR( LTRIM(MID([Owner], INSTR( [Owner], '/')+1)), '/')-1)),LTRIM(MID([Owner], INSTR( [Owner], '/')+1))) AS 'firstname',City FROM Policies";
DataTable Policies = new DataTable();
acessConn.Open();
OleDbCommand myAccessCommand = new OleDbCommand(acessquery, acessConn);
OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(myAccessCommand);
myDataAdapter.Fill(Policies);
acessConn.Close();
The connection is working perfect but I got an exception in myDataAdapter.Fill(Policies);
say :
"The provider could not determine the Object value. For example, the row was just created, the default for the Object column was not available, and the consumer had not yet set a new Object value."
Note :The query is working on Microsoft access.
The connection string is:
string accconnstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + folderserverpath;`
where folderserverpath
is the database path on the server.
Why did I get this error and what is the solution ?