"Savas Ates" <in da club> schrieb
Dim xx As SqlClient.SqlDataReader
I take values from my db by appliying that method. ?
How do you intend to handle Null values coming from the database? You can
not store them in a string. Declare the variable As Object.
dim ProductPropertyValues_Value as object
ProductPropertyValues = xx("ProductPropertyValues_Value")
Later, if you want to distinguish between Null and String, you have to
write:
if ProductPropertyValues_Value is dbnull.value then
'handle null value
else
'handle string
end if
- OR -
Some people convert DBNull to Nothing in order to be able to declare the
variable As String:
Dim ProductPropertyValues_Value as string
dim o as object
o = xx("ProductPropertyValues_Value")
if o is dbnull.value then
ProductPropertyValues_Value = Nothing
else
ProductPropertyValues_Value = o.ToString
end if
Later usage:
if ProductPropertyValues_Value is nothing then
'...
else
'...
end if
Later, if you want to save the values back to the database, you have to
convert back from Nothing to DBNull.Value.
Typed datasets, or classes that you create on your own, can have typed
members (As String) that simplifies this (because the member is typed), and
they have additional "IsMemberNull" and "SetMemberNull" methods.
Armin