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

  • Thread starter Thread starter Karunakararao
  • Start date Start date
K

Karunakararao

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;}
 
Hi Karunakararao,

The null value in a database is DBNull.Value, you can pass that.
 
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
 
Have you tried

SqlInt32.Null
or
DBNull.Value

Hope this helps.
rawCoder
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top