Invalid index -1 for this Parameter

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
mabradle
Posts: 1
Joined: Sat 02 Jun 2007 03:04

Invalid index -1 for this Parameter

Post by mabradle » Sat 02 Jun 2007 03:10

I am using MySQL Direct.Net 3.5 with VB 2005. I have a simple application with one table with 6 fields in a MySQL 5.0 database where I have hand written the code for the MySqlDataAdapter.SelectCommand, .InsertCommand, .DeleteCommand, and .UpdateCommand. I fill the DataSet without incident. When I make a change to any one record in the DataSet then call MySqlDataAdapter.Update(DataSet, MySqlConnection) I get an error message stating: Invalid index -1 for this Parameter.

I have 6 MySqlDataAdapter.UpdateCommand.Parameter. They all contain proper values at the time of the error. Why is MySqlDataAdapter.Update() referencing a parameter index of -1? How can I fix this?

Thanks for your help.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Mon 04 Jun 2007 07:11

Please send me small test project to reproduce the problem.
It is desirable to use 'test' schema objects, otherwise include the definitions of your own database objects.
Use e-mail address provided in the Readme file.
Do not use third-party components.

createsoftware
Posts: 3
Joined: Wed 13 Feb 2008 17:04

I have the same problem

Post by createsoftware » Wed 13 Feb 2008 17:10

Hi
I have the same problem. I have a simple table and i use the following code

... i fill an object array (tktarray) with the new values

myTicketsDataSet.Tables(0).BeginLoadData()
myTicketsDataSet.Tables(0).LoadDataRow(tktarray, False)
myTicketsDataSet.Tables(0).EndLoadData()

Dim changeTktTab As DataTable = myTicketsDataSet.Tables(0).GetChanges(DataRowState.Modified)


MySqlConnection2.Open()
myTicketsAdapter.SelectCommand.ExecuteNonQuery()

myTicketsAdapter.Update(changeTktTab)

The lase red line gives me the error

So what is the correct procedure to update a row with a mysqldataadapter ?

Thanks

H

Alexey.mdr
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Post by Alexey.mdr » Thu 14 Feb 2008 13:07

You can see our demo projects here:
%Program Files%CoreLab\MyDirect.NET2\Samples\WinForms\
If that is not of much help, please send me (alexey*crlab*com) a small test project to reproduce the problem.
Please include the definition of your own database objects.
Do not use third party components.
If it is impossible for you to create the test project, send us a piece of
your code where the error occurs.

createsoftware
Posts: 3
Joined: Wed 13 Feb 2008 17:04

-1 invalid parameter ...etc

Post by createsoftware » Thu 14 Feb 2008 16:00

Thanks for the reply - i decided to just use the mysqldatatable - seems to be equally effective and a smaller memory footprint. Plus that's what you guys use for the same functionality in your samples

Alexey.mdr
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Post by Alexey.mdr » Thu 14 Feb 2008 16:38

It's up to you, it may depend on your goals.
But if you would like to find out what had caused the exception, just feel free to contact us.

Post Reply