Page 1 of 1

Output parameter problem....

Posted: Tue 18 Jan 2005 15:23
by mmccord
I'm having trouble with output parameters when using mysqldirect.net in Visual Studio with VB and ASP.NET.

Here is the problem:

First of all, for some reason if you look at the property building for a mysqlcommand and look at the parameters tab. It will no longer allow you to select what direction you want the parameter to be. Which is fine because I have just been setting it programmatically. (If some one could tell me why its doing this...it would be appreciated.

The real problem is that I can never get output parameters to work correctly. When ever I make a new output parameter and set its direction and source column and then run the query. It always tells me that the parameter is missing from the commandtext. So, is there something that I am supposed to put in the command text? Please advise. Thanks!

Re: Output parameter problem....

Posted: Wed 19 Jan 2005 13:06
by Oleg
MySql server has some problems with out parameters in stored procedures/functions.
On the server side you can use them, but clients (including our) can't get their values.
Exactly so MySqlCommand editor does not support changing of Direction property.

So how...

Posted: Wed 19 Jan 2005 21:39
by mmccord
So how can I bring individual values out of the database? For instance, how could I bring the value of last_insert_id() function out of the database? Or how could I bring the value of a row item out after I have inserted or updated it? Are there alternatives to using output parameters?

Posted: Thu 20 Jan 2005 14:58
by leek
Add handler for the OnRowUpdated event. Run a command such as 'SELECT LAST_INSERT_ID()' within this handler, and set the corresponding row using this value. The .NET documentation has examples in access - can be easily adapted.

Re: So how...

Posted: Fri 21 Jan 2005 12:05
by Oleg
You can use SELECT ... without FROM clause. You can use several SQL statements at the same command, for example:

Code: Select all

INSERT INTO DEPT VALUES(100, 'SOME NAME','');SELECT * FROM DEPT WHERE
DEPTNO=100;