如何从ASP.Net中受密码保护的访问数据库中获取数据? [英] How to Fetch Data from Password Protected Access Database in ASP.Net?

查看:111
本文介绍了如何从ASP.Net中受密码保护的访问数据库中获取数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此连接代码插入,更新&删除内容

I use this Connection Code to insert, update & delete the content

Dim constr As String = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & Server.MapPath("../databasename.mdb;")& "Jet OLEDB:Database Password=mypassword;"



哪个工作正常,


现在,当我从数据库中将数据加载到某些页面时,网页显示错误和错误;重定向到错误页面.

对于加载数据,我使用以下代码:



Which Work Fine,


Now when I Load the Data into Some Page from Database, the Webpage Display Error & Redirect to Error Page.

For Load Data I use Following code :

<asp:AccessDataSource ID="ADSource" runat="server" DataFile="~/databasename.mdb" SelectCommand="SELECT * FROM [Table]"></asp:AccessDataSource>



1)为什么,这是因为我没有在上述代码中添加密码?如果是,如何在上述代码中添加密码?

2)如何将上述连接代码设置为Web.config&



1) Why, Its because I didn''t add password into above code? If Yes, How to Add Password into Above Code?

2) How to Set above Connection Code into Web.config & Use it into Webpage?

推荐答案

AccessDataSource将不会连接到受密码保护的Access数据库;请使用它.要从受密码保护的Access数据库中检索数据,请使用SqlDataSource控件.

http://msdn.microsoft.com /en-us/library/system.web.ui.webcontrols.sqldatasource(v=vs.100).aspx [
The AccessDataSource will not connect to an Access database that is password-protected; to retrieve data from a password-protected Access database, use the SqlDataSource control.

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource(v=vs.100).aspx[^]


这篇关于如何从ASP.Net中受密码保护的访问数据库中获取数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆