executeread命令同时从一个数据库中访问库中的两张表!!!!!
If Page.IsValid Then
Dim StrConn As String = "user ID = sa; password =;"
StrConn += "database = bugs; server = (local);"
StrConn += "connect timeout =30"
Dim Conn As New SqlConnection(StrConn)
Conn.Open()
Dim StrSql As String = "SELECT * FROM muser WHERE userid =" & TempUser & ", passwd=" & TempPassword
Dim Cmd As New SqlCommand(StrSql, Conn)
Dim Dr As SqlDataReader = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
Dim ReadTrue As Boolean = False
If Dr.Read() = True Then
Dim TempStr As String
TempStr = Dr("sect")
Response.Write("SECT:" & TempStr & "<br>")
ReadTrue = True
End If
If ReadTrue = True Then
StrSql = "SELECT msg FROM mmsg WHERE msgid = 'msg001'"
Cmd = New SqlCommand(StrSql, Conn)
Dr = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
If Dr.Read() = False Then
Else
Session("msgid") = Dr("msgid")
Response.Write("MSGID:" & Session("msgid") & "<br>")
Session("msg") = Dr("msg")
Response.Write("MSG:" & Session("msg") & "<br>")
Dim num As Double = 0.1
Do While num > 99999.0
num += 0.1
Loop
End If
Conn.Close()
Response.Redirect("PCom002.aspx")
End If
End If
执行总有错误,executereader行有错误