Page 1 of 1
Invalid index -1 for this Parameter
Posted: Sat 02 Jun 2007 03:10
by mabradle
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.
Posted: Mon 04 Jun 2007 07:11
by Alexey
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.
I have the same problem
Posted: Wed 13 Feb 2008 17:10
by createsoftware
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
Posted: Thu 14 Feb 2008 13:07
by Alexey.mdr
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.
-1 invalid parameter ...etc
Posted: Thu 14 Feb 2008 16:00
by createsoftware
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
Posted: Thu 14 Feb 2008 16:38
by Alexey.mdr
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.