In VB.NET is there a SQL IsNull(value,valueifNull) or Access NZ Type Function
:wave: Hi Guys,
In VB.NET is there a
SQL IsNull(value,valueifNull) or
Access NZ Type Function
ie if an object or a string value is null you can give it a default value using a function
eg
If IsNull(me.txtname.text,"Blank") = "Blank" Then
msgbox "Please enter name"
end if
Thanks
Rag
Re: In VB.NET is there a SQL IsNull(value,valueifNull) or Access NZ Type Function
Hi. there a sample on how to check sql null.
VB Code:
con.ConnectionString = constring
con.Open()
com.Connection = con
com.CommandType = CommandType.Text
com.CommandText = "select codigo from armazem where codigo ='" & artigo & "'"
reader = com.ExecuteReader
While reader.Read
If TypeOf reader(0) Is DBNull Then
existe = False
Else
existe = True
End If
End While
reader.Close()
con.Close()
Re: In VB.NET is there a SQL IsNull(value,valueifNull) or Access NZ Type Function
Re: In VB.NET is there a SQL IsNull(value,valueifNull) or Access NZ Type Function
Thanks guys,
so in .net u have to distinguish between
a DB null and Null assigned to a VB variable because it hasnt been initiated?
Re: In VB.NET is there a SQL IsNull(value,valueifNull) or Access NZ Type Function
Quote:
Originally Posted by ragstta
Thanks guys,
so in .net u have to distinguish between
a DB null and Null assigned to a VB variable because it hasnt been initiated?
corect
Re: In VB.NET is there a SQL IsNull(value,valueifNull) or Access NZ Type Function
You got Nullable, Nothing and DBNull dont know if there are more ;P
more info