DB1.MDB ----表名:Mp-List ----字段名:ID(自动编号)、Mpname(文本)、STATE(数字) Index.ASPX
<%@ Page Language=VB Debug="true"%> <%@ Import Namespace="System.Data" %> <%@ Import NameSpace="System.Data.OleDb" %> <% Dim strCon As String = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source ="& Server.MappAth("DB1.mdb") Dim myConn As OleDbConnection = New OleDbConnection() myConn.ConnectionString = strCon Dim strCom As String = " SELECT * FROM Mp-List" Dim myDataSet = New DataSet() myConn.Open() Dim myCommand As OleDbDataAdapter = New OleDbDataAdapter(strCom, myConn) myCommand.Fill(myDataSet, "Mp-List") myConn.Close() %>
运行结果:
Server Error in '/' Application.
FROM 子句语法错误。
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OleDb.OleDbException: FROM 子句语法错误。 Source Error:
Line 10: myConn.Open() Line 11: Dim myCommand As OleDbDataAdapter = New OleDbDataAdapter(strCom, myConn) Line 12: myCommand.Fill(myDataSet, "Mp-List") Line 13: myConn.Close() Line 14: %>
Source File: E:\ASP.NET\WEB1\index.aspx Line: 12