all groups > dotnet odbc.net > may 2006 >
You're in the

dotnet odbc.net

group:

ERROR [07002] [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect


ERROR [07002] [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect chris NO[at]SPAM spatialdatatech.com
5/4/2006 8:46:33 AM
dotnet odbc.net:
Hello,
I'm running into a big problem here. I'm trying to update an Access
Database from a .NET 2.0 program programatically. The code I'm using
for the update is here:

CPodbcTransferDef TD =
(CPodbcTransferDef)_MyTransferDef;
UpdateConnection = new
OdbcConnection(TD._ConnectionString);

MyDataAdapter = new OdbcDataAdapter();
MyTable = new DataTable(_Name);
MyDataAdapter.TableMappings.Add(_Name, _Name);
UpdateConnection.Open();

OdbcCommand Cmd = new OdbcCommand("SELECT * FROM [" +
_Name + "]", UpdateConnection);
Cmd.CommandType = CommandType.Text;

MyDataAdapter.SelectCommand = Cmd;

MyDataAdapter.FillSchema(MyTable, SchemaType.Source);
MyDataAdapter.Fill(MyTable);


//Modify data in table.


OdbcCommandBuilder commandBuilder = new
OdbcCommandBuilder(MyDataAdapter);
commandBuilder.QuotePrefix = "[";
commandBuilder.QuoteSuffix = "]";

MyDataAdapter.Update(MyTable);
UpdateConnection.Close();

It works about 60 % of the time. Other times I get ERROR [07002]
[Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect.

The complete stack trace is:
at
System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at
System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable
dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataTable dataTable).

Could anyone offer some insight as to what is causing this error?
Re: ERROR [07002] [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect Chris
5/4/2006 9:23:55 AM
I found that if I don't set a datetime field, it works fine. What is
happening that I can't set a datetime field using a System.Datetime
object?
Re: ERROR [07002] [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect Chris
5/4/2006 2:38:44 PM
Worked on some datetime fields, not others.

Ran find/replace and switched Odbc to OleDb and everything works
great...
Re: ERROR [07002] [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect Paul Clement
5/5/2006 7:11:18 AM
[quoted text, click to view]

¤ Worked on some datetime fields, not others.
¤
¤ Ran find/replace and switched Odbc to OleDb and everything works
¤ great...

Yes, I would definitely avoid using ODBC and the Microsoft Access driver if possible. Jet OLEDB is
more stable and has better feature support.


Paul
~~~~
AddThis Social Bookmark Button