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中保存它
答案 0 :(得分:0)
也许:
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
如果返回的行多于一列,则需要进行处理。