470,594 Members | 1,231 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,594 developers. It's quick & easy.

how can i pass the value"null" in to the database

Hi all

Presently i am sending data to database filed like this
"EquipmentFilterDevPrimaryId = 0"

i need Instead of "0" (NULL)i need store the data null value

how can i pass this null value

pls check that

if(txtDeviceCategory.Text != "")

{usi.EquipmentFilterDevPrimaryId = (long.Parse(txtDeviceCategory.Text));}

else{usi.EquipmentFilterDevPrimaryId = 0;}
Nov 16 '05 #1
3 1472
Hi Karunakararao,

The null value in a database is DBNull.Value, you can pass that.

--
Happy coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #2
Hi,

I am not sure about it but if you dont set the value and in the Database
null values is allowed, then does it write Null in database.

Hope this helps.
rawCoder
Nov 16 '05 #3
Have you tried

SqlInt32.Null
or
DBNull.Value

Hope this helps.
rawCoder
Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Marcus | last post: by
13 posts views Thread by Don Vaillancourt | last post: by
8 posts views Thread by craigkenisston | last post: by
2 posts views Thread by Stanislav Simicek | last post: by
9 posts views Thread by D. Shane Fowlkes | last post: by
2 posts views Thread by Anastasios Papadopoulos | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.