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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Null Image into SQL SERVER From VB.NET App

Status
Not open for further replies.

ciscowiz

MIS
Apr 21, 2004
146
0
0
US
I use SQL Server 2000 and VB.NET in my ASP.NET app. I am trying to insert data of type 'image', along with other data by using a stored procedure with parameter type of 'image'. I can insert the data just fine if I provide a legitimate path to an image. In other words, I know how to insert the image but the image is not mandatory, so if there is no image I am getting an error. How would I provide a "NULL" value for my image type?

In SQL Query Analyzer I can exec the SP with the image set to null just fine so it must be possible in VB. Let me know if you need more info, etc.

Thanks,
Bryan
 
Bryan,
I know nothing about SQL Server. But in most databases, each field has a property like "Allow Null" value.

Please check if you have set this property to "True" or "Yes".
Then, in your insert statement, maybe, you need to put DbNull as it's value.

Regards,
mansii
 
Oh i figured it out, I knew it was something simple: you just give the parameter the value of DBNull.Value in VB.NET. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top