主题:在VB.NET中什么可以取代VB6中的IsNull()函数
这是程序中一个按纽中的代码,请高手帮助分析一下:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SqlCmdGR.Connection = SqlConnGR
SqlCmdGR.CommandText = "SELECT DISTINCT XQ_Name FROM DangAn"
Dim strTemp As String
Dim reXQName As SqlDataReader
SqlConnGR.Open()
reXQName = SqlCmdGR.ExecuteReader()
While reXQName.Read
If reXQName.GetString(0) Then
strTemp = reXQName.GetString(0).Trim & vbCrLf '由于SQL2000库中的段XQ_Name可以用空,故reXQName.GetString(0)的值为NULL时程序出错,怎样判断reXQName.GetString(0)是否为空,为空则跳过
ListBoxXQ.Items.Add(strTemp)
End If
End While
reXQName.Close()
SqlConnGR.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SqlCmdGR.Connection = SqlConnGR
SqlCmdGR.CommandText = "SELECT DISTINCT XQ_Name FROM DangAn"
Dim strTemp As String
Dim reXQName As SqlDataReader
SqlConnGR.Open()
reXQName = SqlCmdGR.ExecuteReader()
While reXQName.Read
If reXQName.GetString(0) Then
strTemp = reXQName.GetString(0).Trim & vbCrLf '由于SQL2000库中的段XQ_Name可以用空,故reXQName.GetString(0)的值为NULL时程序出错,怎样判断reXQName.GetString(0)是否为空,为空则跳过
ListBoxXQ.Items.Add(strTemp)
End If
End While
reXQName.Close()
SqlConnGR.Close()
End Sub