Objectmix
Tags Register Mark Forums Read

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

This is a discussion on ERROR [07002] [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect within the DOTNET forums in Framework and Interface Programming category; 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 ...


Object Mix > Framework and Interface Programming > DOTNET > ERROR [07002] [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect

DOTNET Discussion forums related to Microsoft Dot net technologies, CSharp and other related items

Reply

 

LinkBack Thread Tools
  #1  
Old 05-04-2006, 10:46 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default ERROR [07002] [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect

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?

  #2  
Old 05-04-2006, 11:24 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: ERROR [07002] [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect

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?

  #3  
Old 05-04-2006, 04:39 PM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: ERROR [07002] [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect

Worked on some datetime fields, not others.

Ran find/replace and switched Odbc to OleDb and everything works
great...

  #4  
Old 05-05-2006, 07:11 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: ERROR [07002] [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect

On 4 May 2006 14:38:44 -0700, "Chris" <chris@spatialdatatech.com> wrote:

¤ 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
~~~~
Microsoft MVP (Visual Basic)
Reply

Thread Tools


Similar Threads

Thread Thread Starter Forum Replies Last Post
Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC Microsoft Access Driver] Syntax error in date in query expression 'MANUAL # LIKE '%Plant%' OR TITLE LIKE '%Plant%' OR VENDOR LIKE '%Plant%''. usenet Inetserver 1 08-01-2006 11:02 AM
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression. usenet Inetserver 2 03-09-2005 05:15 AM
[Microsoft][ODBC Microsoft Access Driver] Disk or network error usenet Inetserver 1 02-16-2005 08:12 AM
ERROR [07002] [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect usenet DOTNET 0 07-29-2004 02:46 AM
ERROR [ HY000 ] [ Microsoft][ODBC Microsoft Access Controller] usenet DOTNET 1 09-08-2003 04:06 AM


All times are GMT -5. The time now is 12:48 AM.

Managed by Infnx Pvt Ltd.