vb.net - 使用 sql serverce 2008 的 vb.net 中的行/列不存在数据
问题描述
Try
If conn.State <> ConnectionState.Open Then
conn.Open()
End If
scmd.CommandText = "select bal, billamnt from bills "
Dim drr2 As SqlCeDataReader
drr2 = scmd.ExecuteReader
If drr2.Read Then
bal = dta(drr("bal"))
End If
Catch ex As Exception
End Try
Catch ex As Exception
End Try
我在 drr2 中遇到错误,错误是:在 drr1 执行时,行/列不存在数据
请在 vb.net 中解决
解决方案
也许:
Try
If conn.State <> ConnectionState.Open Then
conn.Open()
End If
scmd.CommandText = "select bal, billamnt from bills"
Dim drr2 As SqlCeDataReader = scmd.ExecuteReader
While drr2.Read()
bal = dta(drr2("bal"))
End While
Catch ex As Exception
End Try
如果您返回多行,则需要处理。