Looking for a function instead of procedure
Posted by: Gerry Whitmarsh
Date: February 09, 2015 01:55PM

I am not sure if this belongs in a this forum or Microsoft Visual Studio.
MySQL 5.6
MySQL Connector Net 6.8.3
MySQL for Visual Studio 1.2.3
Visual Studio 2013 Community

I have a stored procedure “sp_putcrm” defined as
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_putcrm`(
IN typecrm INT,
IN in_out CHAR(1),
IN userid CHAR(10),
IN sender_email varchar(64),
IN recipient_email varchar(64),
IN emailsubject TEXT,
IN bodytext TEXT,
IN brokercomment TEXT,
OUT result CHAR(10))
BEGIN
If I execute the procedure in VS 2013 (no out parameter) using MySqlReader it works fine, but because I wish to get a return value I am trying to use ExecuteScalar().
Code:
Public Sub Tester2(ByVal control As Office.IRibbonControl)
Dim cmd As New MySqlCommand
Dim returnValue As Object
Dim Param As New MySqlParameter()
cmd.CommandText = "sp_putcrm"
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = conn

Param.Direction = Data.ParameterDirection.ReturnValue
Param.ParameterName = "result"
cmd.Parameters.Add(Param)
cmd.Parameters.AddWithValue("@typecrm", 1)
cmd.Parameters.AddWithValue("@in_out", "I")
cmd.Parameters.AddWithValue("@userid", userID)
cmd.Parameters.AddWithValue("@sender_email", "email")
cmd.Parameters.AddWithValue("@recipient_email", "email")
cmd.Parameters.AddWithValue("@emailsubject", "Subject") cmd.Parameters.AddWithValue("@bodytext", "Body")
cmd.Parameters.AddWithValue("@comments", "Comments")
Param.Direction = Data.ParameterDirection.ReturnValue
Param.ParameterName = "result"
conn.Open()
returnValue = cmd.ExecuteScalar()
conn.Close()
End Sub

Here I am always getting an exception {"FUNCTION winbroker.sp_putcrm does not exist"}
As I define cmd.CommandType = CommandType.StoredProcedure why is it looking for a FUNCTION?
Any help would be very much appreciated.
Thanks,
Gerry.

Options: ReplyQuote


Subject
Written By
Posted
Looking for a function instead of procedure
February 09, 2015 01:55PM


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.