SQL ExecuteReader()错误 - VB.Net

时间:2014-04-15 15:54:14

标签: sql vb.net ms-access executereader

所以我正在尝试从状态为2的MDB文件中读取并显示所有来源,并且我一直收到此错误:

Microsoft.VisualBasic.dll中发生了'System.Data.OleDb.OleDbException'类型的异常,但未在用户代码中处理

当我拿出Where status = 2时它工作正常,但我需要那里的地方。

<script runat="server">
sub Page_Load
        Dim dataconnector, strSQL, datacommand, dataread
        dataconnector = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & Server.MapPath("cgiclass.mdb"))
        strSQL = "SELECT * FROM suppliers WHERE status = 2"
        dataconnector.Open()
        datacommand = New OleDbCommand(strSQL, dataconnector)
        dataread = datacommand.ExecuteReader()
        suppliers.DataSource = dataread
        suppliers.DataBind()
        dataread.Close()
        dataconnector.Close()
    End Sub
</script>

0 个答案:

没有答案