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.
Invalid index -1 for this Parameter
-
- Posts: 3
- Joined: Wed 13 Feb 2008 17:04
I have the same problem
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
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
-
- Posts: 729
- Joined: Thu 13 Dec 2007 10:24
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.
%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.
-
- Posts: 3
- Joined: Wed 13 Feb 2008 17:04
-1 invalid parameter ...etc
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
-
- Posts: 729
- Joined: Thu 13 Dec 2007 10:24