ExecuteReader错误

时间:2016-03-08 14:57:02

标签: mysql asp.net odbc

我在这里有这些代码行,问题是myReader = myCommand.ExecuteReader总是收到错误消息。

代码:

Dim myConnection As OdbcConnection
Dim myCommand As OdbcCommand
Dim myReader As OdbcDataReader

myConnection = New OdbcConnection("DRIVER={MySQL ODBC 3.51 Driver};Database=usermanagement;Server=localhost;UID=root;")
myConnection.Open()

If myConnection.State = 0 Then
    myConnection.Open()
End If
Dim dt As Date = DateTime.Today
dt.ToString("yyyy-MM-dd")
Dim strDate As String = DateTime.Now.ToString("yyyy-MM-dd")

myCommand = New OdbcCommand("select * from reserved where date =" + "CURDATE()+ INTERVAL 1 DAY" + " and rm_id=" + Request.QueryString("rm_id"), myConnection)
myReader = myCommand.ExecuteReader


While (myReader.Read()) %>
    if (s == "<%Response.Write(myReader.Item("bsched_id"))%>") {

        staroom += "<%Response.Write(myReader.Item("room"))%>,";
    }
    document.getElementById("date").innerHTML = "<%Response.Write(myReader.Item("date"))%>"
    <% End While
myReader.Close()
myConnection.Close()

0 个答案:

没有答案