再问个问题啊
Public Sub ConnectDataBaseAA(ByVal subject As String)
Try
myConnection = New SqlConnection("server=cx;uid=liu;pwd=liu;database=DB")
myConnection.Open()
myCommand = New SqlCommand("Select * from tb1 where Subject = '" & subject & "'", myConnection)
dr = myCommand.ExecuteReader
Dim i As Integer
Do
While dr.Read()
Console.WriteLine("Mail subject:
{0}", subject)
End While
Loop While dr.NextResult()
Catch
End Try
dr.Close()
myConnection.Close()
End Sub
我要查询数据库里的Subject字段,如果有和接收到的subject变量的值相同的话就显示出来,但是我这样写了什么也显示不出来
我把While dr.Read()改为While Not dr.Read(),可以显示,但是所有的都显示出来了,包括数据库里没有的也显示了,没起到过滤的作用,怎么办