Easy A
Would you like to react to this message? Create an account in a few clicks or log in to continue.


 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  

Share
 

 Procedure or function expects parameter which was not

View previous topic View next topic Go down 
AuthorMessage
SunDrop
Member
Member
SunDrop

Posts : 2
Join date : 2011-06-24

Procedure or function expects parameter which was not Empty
PostSubject: Procedure or function expects parameter which was not   Procedure or function expects parameter which was not EmptyWed Jun 29, 2011 8:29 am

I am calling a stored procedure to delete a record:
Code:

 Protected Sub deleteThisOfficer(ByVal sender As Object, ByVal e As EventArgs)
        Dim sqlConn As SqlConnection = New SqlConnection(strConnString)
        sqlConn.Open()
        Dim sqlText As String = "ILETSB.PTB.uspDeleteIndividual"
        Dim sqlCmd As New SqlCommand(sqlText)
        sqlCmd.CommandType = Data.CommandType.StoredProcedure
        sqlCmd.Parameters.AddWithValue("IndId", Request.QueryString("oid"))
        sqlCmd.Parameters.AddWithValue("UserId", hfUserId.Value)
        sqlCmd.Connection = sqlConn
        sqlCmd.ExecuteNonQuery()
    End Sub
The procedure deletes the record and executes in SQL Server Mgmt Console with no errors. But when run from a ASP.Net page I get the error:
Procedure or function 'uspDeleteIndividual' expects parameter '@IndId', which was not supplied.

Since the record is being deleted and the procedure places a copy of the deleted record in an audit table along with the ID of the person deleting the record, I know the parameters are being passed. Anybody know what is going on?
Back to top Go down
Scene<3
Member
Member
Scene<3

Posts : 3
Join date : 2011-06-05

Procedure or function expects parameter which was not Empty
PostSubject: Re: Procedure or function expects parameter which was not   Procedure or function expects parameter which was not EmptyWed Jun 29, 2011 8:30 am

i don't know what lang you are using but here is a snippet demo of a C# that calls a stored SQL procedure... you can maybe adapt to ur use... i think you are literally missing the "@" symbol... look at my parameteres and how it's called
Code:

SqlConnection conn = new SqlConnection(path);
         
            /* set up call for stored procedure */
            SqlCommand doit = new SqlCommand("usp_insert_tbl_monster", conn);
            doit.CommandType = CommandType.StoredProcedure; 
            // parameter settings
            doit.Parameters.Add(new SqlParameter ("@mName", name));
            doit.Parameters.Add(new SqlParameter("@mType", type));
            doit.Parameters.Add(new SqlParameter("@mFriendly", friend));
            /* end call params */

            conn.Open();
            doit.Connection = conn;       
            doit.ExecuteNonQuery();
            conn.Close();
Back to top Go down
SunDrop
Member
Member
SunDrop

Posts : 2
Join date : 2011-06-24

Procedure or function expects parameter which was not Empty
PostSubject: Re: Procedure or function expects parameter which was not   Procedure or function expects parameter which was not EmptyWed Jun 29, 2011 8:30 am

Thanks for responding, this is a very frustrating problem. I have wasted a few hours on it already. I am using VS2010, the page is in ASP.Net with VB. I suspect the error has to do with the parameters being passed (an int for an ID and character string for login ID). I tried using the method you are describing first, but VS told me that method was outdated and to use AddWithValue method instead. It doesn't seem like they worked out the bugs on it.

By the way, including the "@" sign on the parameters had no effect. The SQL stored proc ran fine, moved records to archive, recorded the delete operation and deleted the records I wanted to remove. Then the browser shot up the same message about the procedure needing the parameter passed to it (that was obviously passed since it archived the data then deleted the records). And as I stated in the first post, the stored proc executes inside of SQL Server with no issues, it is only when the function is called from the web page that the error pops up.
Back to top Go down
Scene<3
Member
Member
Scene<3

Posts : 3
Join date : 2011-06-05

Procedure or function expects parameter which was not Empty
PostSubject: Re: Procedure or function expects parameter which was not   Procedure or function expects parameter which was not EmptyWed Jun 29, 2011 8:31 am

the method i posted is C#... u need to do the same thing but with VB ( i build on VS2010 as well woo woo ) anyways check here for MSDN code syntax's and snippets then apply accordingly. Sorry I can;t be of further help, I only know C# my boss knows VB and he made me learn C# to make sure we had all bases covered
Back to top Go down
Sponsored content




Procedure or function expects parameter which was not Empty
PostSubject: Re: Procedure or function expects parameter which was not   Procedure or function expects parameter which was not Empty

Back to top Go down
 

Procedure or function expects parameter which was not

View previous topic View next topic Back to top 
Page 1 of 1

 Similar topics

-
» getting procedure from module
» Why does document.getElementById work without a parameter?
» Can you use a select parameter as a field in the dataset?

Permissions in this forum:You cannot reply to topics in this forum
Easy A :: Procedure or function expects parameter which was not Edit-trash Useless :: Trash-