各位大侠,我在利用ODBC连接ACCESS数据库时出现了问题:
系统:win200server
已安装程序:.netframework.SDK1.1版, MDAC_TYP(2.8), IIS.普通ASP网页能打开运行.
源代码:
<%@ Page Language="VB" Debug="true" %> <%@ import Namespace="system.data" %> <%@ import Namespace="system.data.oledb" %> <script runat="server">
Sub Page_Load(Byval Sender As Object,ByVal e As EventArgs) Dim i,ResultString Dim String1 As String Dim MyDataSet As Dataset String1="Provider=Microsoft.Jet.OLEDB.4.0;DataSource="&Server.MapPath("mydatabase.mdb") Dim MyConnection As New OLEDBConnection(String1) Dim MyCommand As New OLEDBCommand("Select * from 雇员表") MyCommand.Connection=MyConnection MyConnection.Open() Dim MyDataReader As OLEDBDataReader MyDataReader=MyCommand.ExecuteReader() Do while MyDataReader.Read() for i=0 to MyDataReader.FieldCount-1 ResultString &=MyDataReader.GetName(i)&"="&MyDataReader.Item(i)&"<br>" Next i ResultString &="<hr>" Loop Label1.text=ResultString End Sub
</script> <html> <head> </head> <body> <asp:Label id="label1" runat="server"></asp:Label> </body> </html>
出错信息: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: 找不到可安装的 ISAM。 Source Error:
Line 12: Dim MyCommand As New OLEDBCommand("Select * from 雇员表") Line 13: MyCommand.Connection=MyConnection Line 14: MyConnection.Open() Line 15: Dim MyDataReader As OLEDBDataReader Line 16: MyDataReader=MyCommand.ExecuteReader()Source File: H:\Inetpub\wwwroot\guyuanbiao.aspx Line: 14 Stack Trace:
[OleDbException (0x80004005): 找不到可安装的 ISAM。] System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20 System.Data.OleDb.OleDbConnection.InitializeProvider() +51 System.Data.OleDb.OleDbConnection.Open() +203 ASP.guyuanbiao_aspx.Page_Load(Object Sender, EventArgs e) in H:\Inetpub\wwwroot\guyuanbiao.aspx:14 System.Web.UI.Control.OnLoad(EventArgs e) +55 System.Web.UI.Control.LoadRecursive() +27 System.Web.UI.Page.ProcessRequestMain() +731以上已经将ODBC源连接到数据库mydatabase.mdb,请问是什么原因造成了这种错误,是不是我安装少了某样东西?
我这些大码都是从书上面对着写的,不知道这种错误是什么错误.大侠们能不能解释一下?