Hello,

I am trying to populate a form from a SQL server table that allows null values. So after I read in a record I am trying to check if the field value is null so that I can assign "" to the textbox on the form. In the example below, if there is a value in the vendor field it works fine. If there is a NULL value in the vendor field it does not assign "", it errors. Can someone tell me why my code is not working here?


Imports System.Data.SqlClient
__________________________________

cmSQL = New SqlCommand(strSQL, cnSQL)
drSQL = cmSQL.ExecuteReader()

If drSQL.Read() Then
If IsDBNull(drSQL.Item("vendor").ToString()) Then
txtvendor.Text = ""
Else
txtvendor.Text = drSQL.Item("vendor").ToString()
End If
End If

Thanks,

FoxT