Error with adapter.update command ( formatexception ) ?

T

tommydnp

When I use an adapter.update(dataset, "myTable"), I get the following
error:

System.FormatException: Index (zero based) must be greater than or
equal to zero and less than the size of the argument list.
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String
srcTable)

There is one table with 2 columns and 3 rows in the dataset. Does
anyone know what the problem is?
 
C

Cor Ligthert [MVP]

Tommy,

Are you sure that your dataset contains a table (with the tablename
"myTable")?

Cor
 
T

tommydnp

Tommy,

Are you sure that your dataset contains a table (with the tablename
"myTable")?

Cor

tommydnp said:
When I use an adapter.update(dataset, "myTable"), I get the following
error:
System.FormatException: Index (zero based) must be greater than or
equal to zero and less than the size of the argument list.
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String
srcTable)
There is one table with 2 columns and 3 rows in the dataset. Does
anyone know what the problem is?

I've found a solution. The problem was that I was working with OLEDB
data adapter which doesn't support the "@" parameters for building
commands.
 
C

Cor Ligthert[MVP]

I've found a solution. The problem was that I was working with OLEDB
data adapter which doesn't support the "@" parameters for building
commands

Yea a common problem, however for sure not to track with the information you
gave us. Tell us next time the way you construct and create your parameters.
For sure I (and others) could have told you the problem then direct.
System.FormatException: Index (zero based) must be greater than or
equal to zero and less than the size of the argument list.
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String
srcTable)
There is one table with 2 columns and 3 rows in the dataset. Does
anyone know what the problem is?
..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top