标题:[求助]ASP.NET连接ACCESS数据库问题,求救!
只看楼主
kokoshi
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2004-12-23
 问题点数:0 回复次数:3 
[求助]ASP.NET连接ACCESS数据库问题,求救!

各位大侠,我在利用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,请问是什么原因造成了这种错误,是不是我安装少了某样东西?

我这些大码都是从书上面对着写的,不知道这种错误是什么错误.大侠们能不能解释一下?

搜索更多相关主题的帖子: 数据库 NET ACCESS ASP 
2004-12-23 17:58
ppp5p
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2004-12-16
得分:0 

错的也太多了。

2004-12-24 10:00
水易雨辰
Rank: 1
等 级:新手上路
帖 子:177
专家分:0
注 册:2004-4-15
得分:0 

"Provider=Microsoft.Jet.OLEDB.4.0;DataSource="&Server.MapPath("mydatabase.mdb")

把DataSource改成Data Source中间加个空格,这个错误提示骗过好多人!


授人以鱼,不如授人以渔!
2004-12-24 17:43
kokoshi
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2004-12-23
得分:0 

谢谢斑竹@@@@@@@

成功了!!!!!!!!!!!!!!!

谢谢"水易雨辰"!!!!

2004-12-25 19:04



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-9938-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.119896 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved