stored procedure parametersss

  •  

    hi i hava a stored procedure which accepts some parameters...

    previousy i was working with sqlconnection in asp.net to call this storeprocedure.......every thing was working fine

    but now when i started to use an odbc connection, when ever i call that stored procedure it give me following error msg... Although i have provided all the parameters it recuires........code is also given below...... plz help soon

    Server Error in '/OnlineResume' Application.


    ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure 'login' expects parameter '@loginid', which was not supplied.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.Odbc.OdbcException: ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure 'login' expects parameter '@loginid', which was not supplied.

    Source Error:

    Line 29: sqlcom.Parameters["@loginstatus"].Direction = ParameterDirection.Output;Line 30: sqlcon.Open();Line 31: sqlcom.ExecuteNonQuery();Line 32: int count=Convert.ToInt32(sqlcom.Parameters["@loginstatus"].Value);Line 33: sqlcon.Close();

    Source File: f:\onlineresume\onlineresume\jps\users.cs    Line: 31

    Stack Trace:

    code to call is

    OdbcCommand sqlcom=

    new OdbcCommand("login",sqlcon);

    sqlcom.CommandType=CommandType.StoredProcedure;

    sqlcom.Parameters.Add("@loginid",OdbcType.VarChar);

    sqlcom.Parameters["@loginid"].Value=id;

    sqlcom.Parameters.Add("@password",OdbcType.VarChar);

    sqlcom.Parameters["@password"].Value=password;

    sqlcom.Parameters.Add("@loginstatus", OdbcType.Int);

    sqlcom.Parameters["@loginstatus"].Direction = ParameterDirection.Output;

    sqlcon.Open();

    sqlcom.ExecuteNonQuery();

    int count=Convert.ToInt32(sqlcom.Parameters["@loginstatus"].Value);

  • Check whether you have initialized the variable "id".

    As the visual studio environment has a rich facility for debugging. check the variable you are assigning

    is not null and so on.

    Thanks,

    Ganesh

     

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply