Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I pass a null value for date in vb.net to sql stored procedure?

My application is asp.net with vb.

In my page I have a textbox for passing date. If I didn't enter date and on clicking submit, I have to pass null value to the stored procedure.

I tried following codes such as DBNull.Value and DateTime.MinValue. In that case instead of null, "#12:00:00#" is passing. I have to pass Null.

like image 548
Nandini Avatar asked Mar 16 '09 06:03

Nandini


1 Answers

Just assign the parameter the value DBNull.Value

[EDIT]

If you are using SqlParameter (thanks Jon) then you can set it like this if it gives any error

parameter.Value = DBNull.Value 
like image 67
Binoj Antony Avatar answered Oct 15 '22 07:10

Binoj Antony