Output parameter problem....

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
mmccord

Output parameter problem....

Post by mmccord » Tue 18 Jan 2005 15:23

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!

Oleg
Devart Team
Posts: 264
Joined: Thu 28 Oct 2004 13:56

Re: Output parameter problem....

Post by Oleg » Wed 19 Jan 2005 13:06

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.

mmccord

So how...

Post by mmccord » Wed 19 Jan 2005 21:39

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?

leek
Posts: 8
Joined: Sun 16 Jan 2005 10:51

Post by leek » Thu 20 Jan 2005 14:58

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.

Oleg
Devart Team
Posts: 264
Joined: Thu 28 Oct 2004 13:56

Re: So how...

Post by Oleg » Fri 21 Jan 2005 12:05

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;

Post Reply