|
-
May 6th, 2004, 10:41 AM
#1
Thread Starter
Member
Verifing is field is NULL
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|