as u know about that when database table have int column and u insert null value then by default it convert into 0 and insert into column so i need a null or empty value
as u know about that when database table have int column and u insert null value then by default it convert into 0 and insert into column so i need a null or empty value
Hi! You should define th coumn value as Allow null, if you need to insert null value.
As u know about that when database table have int column and u insert null value then by default it convert into 0 and insert into column so i need a null or empty value..
zeeshanfazal
Member
9 Points
40 Posts
Conversion of Empty Textbox into int field of database table
Apr 28, 2012 07:52 AM|LINK
hello...
I m converting empty textbox
if textbox is empty then insert null otherwise insert convert.toint32(mobilenum.text);
Amin.Mirzapo...
Member
546 Points
98 Posts
Re: Conversion of Empty Textbox into int field of database table
Apr 28, 2012 07:58 AM|LINK
myTable.Property = (String.IsNullOrEmpty(mobilenu.Text))? null : convert.toint32(mobilenum.text));Mahesh Darku...
Participant
896 Points
238 Posts
Re: Conversion of Empty Textbox into int field of database table
Apr 28, 2012 08:00 AM|LINK
If (textbox.text !="")
{
some variable =convert.toint32(mobilenum.text);
}
else
some variable =null;
zeeshanfazal
Member
9 Points
40 Posts
Re: Conversion of Empty Textbox into int field of database table
Apr 28, 2012 08:02 AM|LINK
hello Amin:
as u know about that when database table have int column and u insert null value then by default it convert into 0 and insert into column so i need a null or empty value
Mahesh Darku...
Participant
896 Points
238 Posts
Re: Conversion of Empty Textbox into int field of database table
Apr 28, 2012 08:04 AM|LINK
Set it default value to null,,
Amin.Mirzapo...
Member
546 Points
98 Posts
Re: Conversion of Empty Textbox into int field of database table
Apr 28, 2012 08:08 AM|LINK
Hi! You should define th coumn value as Allow null, if you need to insert null value.
zeeshanfazal
Member
9 Points
40 Posts
Re: Conversion of Empty Textbox into int field of database table
Apr 28, 2012 08:09 AM|LINK
hello Mahesh..
As u know about that when database table have int column and u insert null value then by default it convert into 0 and insert into column so i need a null or empty value..
plz try some else code 4 me ...thanks
Shoaib.Rashi...
Member
130 Points
41 Posts
Re: Conversion of Empty Textbox into int field of database table
Apr 28, 2012 08:10 AM|LINK
Set Property of your int column to allow nulls
zeeshanfazal
Member
9 Points
40 Posts
Re: Conversion of Empty Textbox into int field of database table
Apr 28, 2012 08:10 AM|LINK
I did bro. the column allows null
Amin.Mirzapo...
Member
546 Points
98 Posts
Re: Conversion of Empty Textbox into int field of database table
Apr 28, 2012 08:16 AM|LINK
So! get ride of the unwanted! default value, you don'te have to have default value!
Or you cannot insert null value, even directy in SQL sever!