Stored procedure paramter passing
Posted by: Massimo Fierro
Date: May 30, 2016 11:11PM

I have been readind both MSDN and the Connector's docs and the only examples I find are using cmd.Parameters.AddWithValue.

What I really need to do, though, is setting the UpdateCommand of an DataAdapter to be the the stored procedure.

What I am doing (in C#) is the following (split is a custom object that has a DataAdapter member exposed via the DataAdapter property).

-------------
var updateCmd = new MySqlCommand("updateBrokerSymbols");
var param = new MySqlParameter("@ghrSym", MySqlDbType.VarChar, 9, "ghr_symbol");
param.Direction = ParameterDirection.Input;
updateCmd.Parameters.Add( param.Clone() );

param = new MySqlParameter("@broker", MySqlDbType.VarChar, 10, "broker");
param.Direction = ParameterDirection.Input;
updateCmd.Parameters.Add( param.Clone() );

param = new MySqlParameter("@brokerSym", MySqlDbType.VarChar, 9, "broker_symbol");
param.Direction = ParameterDirection.Input;
updateCmd.Parameters.Add( param.Clone() );

split.DataAdapter.UpdateCommand = updateCmd.Clone();
-------------

When I modify the data in the DataGridView and then launch the update, tgough, I get the following Exception:
"Incorrect number of arguments for PROCEDURE ghr.updateBrokerSymbols; expected 3, got 0"

Any ideas? Help would be greatly appreciated.

Options: ReplyQuote


Subject
Written By
Posted
Stored procedure paramter passing
May 30, 2016 11:11PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.