Bug #59798 | MySqlCommand.CommandType.Text multiple statements, output param won't work | ||
---|---|---|---|
Submitted: | 28 Jan 2011 15:40 | Modified: | 14 Feb 2011 22:04 |
Reporter: | Sean Drun | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / NET | Severity: | S1 (Critical) |
Version: | 6.3.6 | OS: | Windows (Windows 7 Ultimate) |
Assigned to: | CPU Architecture: | Any | |
Tags: | MySqlCommand MySqlParameter OUTPUT |
[28 Jan 2011 15:40]
Sean Drun
[2 Feb 2011 9:42]
Tonci Grgin
Hi Sean and thanks for your report. Does the top of http://dev.mysql.com/doc/refman/5.5/en/connector-net-faq.html page answer your question?
[4 Feb 2011 14:53]
Sean Drun
Thanks for the link of possible get around. But we are porting working project from MSSQL/ORACLE to MySql, we don't have freedom of changing coding structure. We are using MySqlCommand to build CommandText with MySqlParameter dynamically. The structure of table varies on deployed customer. One case is using MySqlCommand.ExecuteNonQuery to get back last row id. The other case is setting MySqlCommand to DataAdapter.InsertCommand with a MySqlParameter.SourceColumn set to Identity column. The only thing certain is OUTPUT MySqlParameter works only in stored procedure. In reality, it is just not possible to build stored procedure for all database tables.
[14 Feb 2011 22:04]
Reggie Burnett
This is not a bug. Connector/Net doesn't currently support output parameters when not using stored procedure or stored functions. We have created an internal worklog to track adding this feature. The user should be aware that Connector/Net fully supports updating datatables and datasets with generated ids but this is not done with parameters. The user can write his insert statement like this: "INSERT (col) VALUES (val); SELECT last_insert_id() AS 'Id'" and then set the UpdatedRowSource property on the command to FirstReturnedRecord and then the command will work with the data adapter and will update the id column of every insert in the data table.
[12 Sep 2012 11:44]
Alexander Sapronov
And what about now? I have exactly same problem as Sean Drun in Jan 2011 I need to get output parameters after call of CommandType.Text The code architecture can't be changed and it dictates just this way of output data handling. Not using stored procedures and not by DataReader. Thanks