+ Reply to Thread
Page 3 of 3 FirstFirst 1 2 3
Results 21 to 25 of 25

Thread: Problem with MySql Stored Procedure

  1. #21
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    I did mine like this:-
    Code:
    Dim EmailIDPara As MySqlParameter = Cmd.Parameters.Add("EmailId", MySql.Data.MySqlClient.MySqlDbType.VarChar)
    EmailIDPara.Value = Trim(txtEmail.Text)
    
    Also your command definition should be:-
    Code:
    Dim Cmd As New MySqlCommand("sp_LoginCheck", Con)
    Cmd.CommandType = CommandType.StoredProcedure
    
    Also, have you tried running your SP in Query Browser?

    <edit>Looks like I removed my SPs from my db and can't fully remember the syntax, but I'm not sure the IN line is the correct syntax. I remember having brackets after the name of my SP that contained a list of all my input parameters and I had to define each of these in my code...Did you have a look at the MySQL SP thread I started?</edit>
    Last edited by richyrich; October 20th, 2008 at 08:38 AM.

  2. #22
    Lazy Bum micky is a jewel in the rough micky is a jewel in the rough micky is a jewel in the rough micky is a jewel in the rough micky's Avatar
    Join Date
    Jul 2008
    Location
    India
    Posts
    1,763
    Blog Entries
    2
    Rep Power
    8

    it works
    but can u explain the difference, ie. the above 2 lines of ur post compared to mine??
    and that means that i dont have to mention the "input" direction....... thats a relief

  3. #23
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    Quote Originally Posted by micky View Post
    it works
    but can u explain the difference, ie. the above 2 lines of ur post compared to mine??
    Which bit do you mean? The command definition or the parameter definition.

    My guess is that the command definition fixed it. You have to specific Stored Procedure as the command type, as it defaults to CommandText ie "SELECT x FROM y"

  4. #24
    Lazy Bum micky is a jewel in the rough micky is a jewel in the rough micky is a jewel in the rough micky is a jewel in the rough micky's Avatar
    Join Date
    Jul 2008
    Location
    India
    Posts
    1,763
    Blog Entries
    2
    Rep Power
    8

    i forgot the command definition line!!
    i meant these lines
    Code:
    Dim EmailIDPara As MySqlParameter = Cmd.Parameters.Add("EmailId", MySql.Data.MySqlClient.MySqlDbType.VarChar)
    EmailIDPara.Value = Trim(txtEmail.Text)
    
    i have added another parameter now like
    Code:
    Dim PswdPara As MySqlParameter = Cmd.Parameters.Add("Pswd", MySql.Data.MySqlClient.MySqlDbType.VarChar)
    PswdPara.Value = Trim(txtPassword.Text)
    
    changed my SP as
    Code:
    CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_LoginCheck`(
      IN EmailId varchar(100),
      IN Pswd varchar(20))
    BEGIN
      Select First_Name, Last_Name From tblUserMaster Where Email_Id=EmailId and User_Pswd=Pswd;
    END
    
    it gived me this error
    Code:
    Incorrect number of arguments for PROCEDURE synccity.sp_LoginCheck; expected 2, got 1
    

  5. #25
    Lazy Bum micky is a jewel in the rough micky is a jewel in the rough micky is a jewel in the rough micky is a jewel in the rough micky's Avatar
    Join Date
    Jul 2008
    Location
    India
    Posts
    1,763
    Blog Entries
    2
    Rep Power
    8

    i chnaged nothing and its now working, ignore the above error

+ Reply to Thread
Page 3 of 3 FirstFirst 1 2 3

Similar Threads

  1. Dynamic Stored Procedure without Building Strings
    By jmurrayhead in forum SQL Code Samples
    Replies: 11
    Last Post: March 17th, 2009, 01:12 PM
  2. Using Parameterized Stored Procedure
    By richyrich in forum MySQL
    Replies: 14
    Last Post: June 12th, 2008, 08:00 AM
  3. Stored Procedures on MySQL
    By richyrich in forum MySQL
    Replies: 7
    Last Post: June 9th, 2008, 12:15 PM
  4. If statement stored procedure
    By peebman2000 in forum SQL Development
    Replies: 32
    Last Post: May 23rd, 2008, 04:54 PM
  5. Dynamic Stored Procedure
    By jmurrayhead in forum Microsoft SQL Server
    Replies: 16
    Last Post: March 26th, 2008, 12:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO