I should know this, but I don't...
How do I enter a null value in an integer field using parameterized SQL?
I have this:
Dim bonding2ID As Integer
If cleanSQLinput(DropDownList_bondingCo2.SelectedItem.Value.ToString) =
"none" Then
bonding2ID = DBNull.Value
Else
bonding2ID =
cleanSQLinput(DropDownList_bondingCo2.SelectedItem.Value.ToString)
End If
But it's not liking the 'DBNull.Value' part.
-Darrel
========================================
=========================
Win prizes searching google:
http://www.blingo.com/friends?ref=h...FnTqhv-2GE1FNtAHi,
I think u r corret.
Try System.DbNull.Value to store a NULL value.
Regards,
Bharti Kumar.
darrel wrote:
> I should know this, but I don't...
> How do I enter a null value in an integer field using parameterized SQL?
> I have this:
> Dim bonding2ID As Integer
> If cleanSQLinput(DropDownList_bondingCo2.SelectedItem.Value.ToString) =
> "none" Then
> bonding2ID = DBNull.Value
> Else
> bonding2ID =
> cleanSQLinput(DropDownList_bondingCo2.SelectedItem.Value.ToString)
> End If
> But it's not liking the 'DBNull.Value' part.
> -Darrel
> ========================================
=========================
> Win prizes searching google:
> http://www.blingo.com/friends?ref=h...FnTqhv-2GE1FNtA
There's no easy way...you can use a nullable type in 2.0, but that only gets
you 1/2 way there anyways.
Write it as a method that returns an object *shrug*
function GetBondId() as object
if BLAH
return DBNull.Value
end if
return cleanSQLinput(BLAHx)
end function
Karl
http://www.openmymind.net/
"darrel" <notreal@.nowhere.com> wrote in message
news:efGE9nunGHA.2312@.TK2MSFTNGP04.phx.gbl...
>I should know this, but I don't...
> How do I enter a null value in an integer field using parameterized SQL?
> I have this:
> Dim bonding2ID As Integer
> If cleanSQLinput(DropDownList_bondingCo2.SelectedItem.Value.ToString) =
> "none" Then
> bonding2ID = DBNull.Value
> Else
> bonding2ID =
> cleanSQLinput(DropDownList_bondingCo2.SelectedItem.Value.ToString)
> End If
> But it's not liking the 'DBNull.Value' part.
> -Darrel
> ========================================
=========================
> Win prizes searching google:
> http://www.blingo.com/friends?ref=h...FnTqhv-2GE1FNtA
>
his problem is assigning DBNull.Value to an integer...which you can't.
Karl
http://www.openmymind.net/
"Bharathi Kumar" <bharathidotnet@.gmail.com> wrote in message
news:1151984411.441988.178080@.m79g2000cwm.googlegroups.com...
> Hi,
> I think u r corret.
> Try System.DbNull.Value to store a NULL value.
>
> Regards,
> Bharti Kumar.
>
> darrel wrote:
>
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment