Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi All,

I am using SQL server 2012 to store data from asp.net webpage gridview.

The issue is that if any column is left blank the above error message of 'SQL expects parameter not supplied' shows up. It is happening for Insert as well as Update commands.

The fields are allowed null in SQL and a direct query in SQL management studio is working fine.

Pls Guide.

Thanks,
Atul
Posted
Comments
Nirav Prabtani 8-Jun-14 2:48am    
Have you used stored procedure for that??
atul sharma 5126 8-Jun-14 3:20am    
Thanks for your reply Nirav. Got solution from digimanus.

1 solution

when sending a parameter to a database the value cannot be NULL. The parameter will not be send then. If a var in NULL then change it to DBNULL.Value.
 
Share this answer
 
Comments
atul sharma 5126 8-Jun-14 3:19am    
Thanks! Earlier I was providing default value to Nothing. Changed it to DBNULL.VALUE.TOSTRING and it worked
Herman<T>.Instance 8-Jun-14 6:21am    
you're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900