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 ...
| DOTNET Discussion forums related to Microsoft Dot net technologies, CSharp and other related items |
![]() |
| | LinkBack | Thread Tools |
|
#1
| |||
| |||
| 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
| |||
| |||
| 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
| |||
| |||
| Worked on some datetime fields, not others. Ran find/replace and switched Odbc to OleDb and everything works great... |
|
#4
| |||
| |||
| 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) |
![]() |
| Thread Tools | |
| |
| ||||
| 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 |



