MySQL Forums
Forum List  »  Stored Procedures

Stored procedures
Posted by: M Lambert
Date: March 07, 2005 11:58AM

Hi,

I have no problems executing queries by code. But I am not able to use stored procedures.

For example:

I have the following stored MySQL query called "MaReq1":

SELECT * FROM `table_medecins` WHERE ID_Medecin=2

No problem if I write and execute the same in VB code like the following:

'========================================================
Dim monReader As System.Data.Odbc.OdbcDataReader

OdbcConnection1.Open()

OdbcCommand1.CommandType = CommandType.Text
OdbcCommand1.CommandText = "SELECT * FROM `table_medecins` WHERE ID_Medecin=2"
monReader = OdbcCommand1.ExecuteReader

While monReader.Read()
Debug.WriteLine(monReader.GetInt32(0).ToString() + ", " _
+ monReader.GetString(1))
End While

OdbcConnection1.Close()
'========================================================

But if I try to call the same query, but the stored one, using code:

'========================================================
OdbcConnection1.Open()

OdbcCommand1.CommandType = CommandType.StoredProcedure
OdbcCommand1.CommandText = "MaReq1"
monReader = OdbcCommand1.ExecuteReader

OdbcConnection1.Close()

'========================================================

I get this error:

ERROR [23000] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MaReq1' at line 1

Is there one of you who have succeeded with a stored procedure ? I use VB .Net but I suspect that the problem could be the same for other programming languages.

I am using myodbc3.dll version 3.51.11.0.

Thanks

Options: ReplyQuote


Subject
Views
Written By
Posted
Stored procedures
4474
March 07, 2005 11:58AM
2104
March 08, 2005 02:45PM
2184
April 15, 2005 01:25AM
2269
April 15, 2005 03:14AM
2127
April 30, 2005 07:34AM
2071
May 03, 2005 10:49AM
2116
June 16, 2005 10:02AM
2064
June 27, 2005 05:26AM
2093
April 18, 2005 06:31AM
2079
June 20, 2005 09:14AM
2112
June 24, 2005 07:15AM
2020
June 28, 2005 01: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.