More Stored Procedure Issues 2006-07-04 - By Jesse
Back VB is not case sensitive, so changing the case didn't make any difference.
I'm still getting the same non-sensical error message.
Jesse
-- -- Original Message -- -- From: "DG @ NEFACOMP" <dg@(protected)> To: "Jesse" <jlc@(protected)>; "MySQL . Net List" <dotnet@(protected)> Sent: Tuesday, July 04, 2006 10:23 AM Subject: Re: More Stored Procedure Issues
> On my side your code works (in C#) but I had to change one line > Cmd.Parameters.Add("?cInvNo",MySQLDBType.VarChar) > > I changed it to: > Cmd.Parameters.Add("?cInvNo", MySqlDbType.VarChar) > (The difference is on the casing of <<<MySqlDbType>>>) > > > > Hope this helps > Emery > -- -- Original Message -- -- > From: "Jesse" <jlc@(protected)> > To: "MySQL . Net List" <dotnet@(protected)> > Sent: Tuesday, July 04, 2006 15:20 > Subject: More Stored Procedure Issues > > >> OK, same SP, different problem. I did some very minor editing of my SP, >> and got rid of some space between parameters, and moved a parenthesis, >> made sure that my user had Execute permissions for SP's, and now, I'm >> getting a different error. I get the error, "42000Incorrect number of >> arguments for PROCEDURE bpa.sp_GetNextInv; expected 2, got 0", which >> makes absolutely no sense to me, because I HAVE defined 2 >> parameters....!!!! Here is my ASP.Net code: >> >> <%@ Import Namespace="System.Data"%> >> <Script Runat="Server"> >> function GetNextInv(nChapterID As Integer) As String >> Dim Cmd As MySQLCommand, Conn AS MySQLConnection >> >> Conn = OpenConn >> >> Cmd = New MySQLCommand("sp_GetNextInv", Conn) >> Cmd.CommandType = CommandType.StoredProcedure >> >> Cmd.Parameters.Add("?nChapterID",nChapterID) >> Cmd.Parameters("?nChapterID").Direction = ParameterDirection.Input >> Cmd.Parameters.Add("?cInvNo",MySQLDBType.VarChar) >> Cmd.Parameters("?cInvNo").Direction = ParameterDirection.Output >> >> Cmd.ExecuteNonQuery() >> >> GetNextInv = CStr(Cmd.Parameters("?cInvNo").Value) >> >> Cmd=Nothing >> Conn.Close >> Conn=Nothing >> >> end function >> </script> >> >> here is the stored procedure: >> >> CREATE PROCEDURE `sp_GetNextInv`( >> in nChapterID Int, >> out cInvNo VarChar(7) >> ) >> BEGIN >> Declare cPrefix VarChar(1); >> Declare cNextInv VarChar(7); >> Set cInvNo = ''; >> >> IF nChapterID > 0 THEN >> SELECT TempInvNo INTO cInvNo FROM Chapters WHERE ID=nChapterID; >> END IF; >> >> IF (cInvNo = '') or (cInvNo IS NULL) THEN >> SELECT NextInvoiceNo INTO cInvNo FROM Config; >> SET cNextInv = Right('0000000' + CONVERT(CONVERT(cInvNo, UNSIGNED) + 1, >> CHAR), 7); >> UPDATE Config SET NextInvoiceNo=cNextInv; >> IF nChapterID = -1 THEN >> Set cInvNo = CONCAT('L',Right(CONCAT('000000',cInvNo),6)); >> END IF; >> IF nChapterID = -2 THEN >> Set cInvNo = CONCAT('C',Right(CONCAT('000000',cInvNo),6)); >> END IF; >> IF nChapterID > 0 THEN >> SELECT CT.InvPrefix INTO cPrefix FROM ChapterType CT, Chapters C >> WHERE C.ID=nChapterID AND CT.ChapterType=C.ChapterType; >> Set cInvNo = CONCAT(cPrefix,Right(CONCAT('000000',cInvNo),6)); >> UPDATE Chapters SET TempInvNo=cInvNo WHERE ID=nChapterID; >> END IF; >> END IF; >> END >> >> If anyone has any clue why it's telling me I haven't defined parameters >> when I have, I would greatly appreciate it. >> >> Thanks, >> Jesse >> >> -- >> MySQL on .NET Mailing List >> For list archives: http://lists.mysql.com/dotnet >> To unsubscribe: http://lists.mysql.com/dotnet?unsub=dg@(protected) >> >> >> >
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=mysql@(protected)
|
|