Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Procedure

Status
Not open for further replies.

durug

Technical User
Mar 22, 2002
335
CA
Hi everybody!

I have a SP that inserts values in a table.
I declared the Parameter for the command object like this
cmd.Parameters.Append cmd.CreateParameter("@location",adInteger,1,1,location)
But if the location variable is empty I assign the null value the this variable like this:
if len(location) = 0 then location = null
so that I can insert the null value in the table.

And is giving this error: Procedure 'sp_insert_new_asset' expects parameter '@location', which was not supplied.

In case location is not empty then everything works fine

What I'm doing wrong?
Thanks
Durug
 
In your stored procedure, does your parameter accept null values? Declare your location parameter like this to accept nulls:

Create Procedure sp_TestNulls
@Location int=NULL

AS

....


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top