word在点击关闭后会弹出来一个提问框长安之星车长多少米,必须回答正确才能关闭

展开阅读全文

DataReader,必须首先将它关闭,这个在什么地方关闭,如何关闭

12-08

Dim username As String = Me.UserName.Text.Replace("'", "")rn Dim password As String = Me.PassWord.Text.Replace("'", "")rn Dim Conn As New OleDbConnection("Data Source=""" & Me.Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings("database")) & """;Provider=""Microsoft.Jet.OLEDB.4.0"";User ID=Admin")rn Dim commstr As Stringrn commstr = "select username,password from T_UserInfo where username ='" & username & "' and password = '" & password & "' and UserLock =0"rn Dim mycomm As New OleDbCommand(commstr, Conn)rn Conn.Open()rn Dim dr As OleDbDataReader = mycomm.ExecuteReaderrnrn If dr.Read Thenrn Me.Session("UserName") = usernamern Me.Panel1.Visible = Falsern Me.Panel2.Visible = Truern dr.Close()rnrn '更新登陆信息rn Dim mycom As New OleDbCommand("UPDATE T_UserInfo SET LoginCount = LoginCount+1 WHERE (UserName = '" & username & "')", Conn)rn mycom.ExecuteNonQuery()rnrn Dim my As New OleDbDataAdapter("SELECT UserId, UserName, LoginCount FROM T_UserInfo WHERE (UserName = '" & username & "')", Conn)rn Dim ds As New DataSetrn my.Fill(ds, "T_UserInfo")rn Me.Label1.Text = ds.Tables(0).DefaultView.Item(0).Item(2)rnrn ''写入登陆日志rn Dim ipstring As String = Me.Request.UserHostAddressrn Dim logmycom As New OleDbCommand("INSERT INTO T_LoginLog (UserName, LoginIP) VALUES ('" & username & "','" & ipstring & "')", Conn)rn logmycom.ExecuteReader()rnrn '得到未结订单信息rn Dim myorder As New OleDbDataAdapter("SELECT COUNT(*) AS Expr1 FROM (SELECT DISTINCT OrderID FROM T_BookOrder WHERE (OrderState = '0') AND (UserName = '" & username & "')) DERIVEDTBL", Conn)rn Dim myorderds As New DataSetrn myorder.Fill(myorderds, "T_BookOrder")rnrn错误提示如下:rnrnrn已有打开的与此连接相关联的 DataReader,必须首先将它关闭。 rn说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 rnrn异常详细信息: System.InvalidOperationException: 已有打开的与此连接相关联的 DataReader,必须首先将它关闭。rnrn源错误: rnrnrn行 90: Dim myorder As New OleDbDataAdapter("SELECT COUNT(*) AS Expr1 FROM (SELECT DISTINCT OrderID FROM T_BookOrder WHERE (OrderState = '0') AND (UserName = '" & username & "')) DERIVEDTBL", Conn)rn行 91: Dim myorderds As New DataSetrn行 92: myorder.Fill(myorderds, "T_BookOrder")rn行 93: 'Me.Label3.Text = myorderds.Tables(0).DefaultView.Item(0).Item(0)rnrnrn源文件: F:\Inetpub\wwwroot\Website\LoginAscx.aspx.vb 行: 92 rn rnrnrnDataReader,必须首先将它关闭,这个在什么地方关闭,如何关闭?小弟很菜,请指教rn 论坛

没有更多推荐了,返回首页