簡體   English   中英

System.Data.OleDb.OleDbException:無效的密碼。 在MS Access數據庫ASP.NET/C# Web應用程序中

[英]System.Data.OleDb.OleDbException: Not a valid password. in MS Access database ASP.NET/C# Web app


我陷入了令人擔憂的問題中。 使用MS Access 2007數據庫開發了一個ASP.NET/C# Web應用程序。數據庫與我開發該應用程序的服務器位於同一服務器(Windows服務器2008 R2)中。 它具有一個簡單的GridView來顯示搜索結果。 當它在本地主機上運行時,它可以完美運行,並且沒有任何錯誤提示。 將其部署在服務器上的IIS中時,在搜索GridView時開始出現以下錯誤。

Server Error in '/' Application.
Not a valid password.

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: Not a valid password.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

 Stack Trace: 


[OleDbException (0x80040e4d): Not a valid password.]
System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +337
System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +86
   System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +31
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +76
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +126
System.Data.OleDb.OleDbConnection.Open() +43
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +123
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +319
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +92                  System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1618
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
System.Web.UI.WebControls.GridView.OnPreRender(EventArgs e) +26
System.Web.UI.Control.PreRenderRecursiveInternal() +103
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496

This error is not generated while it runs on localhost

嘗試了3天,並嘗試了Internet上的許多解決方案,但沒有任何進展。 請幫助。

這是與權限相關的問題。您應使用有效的用戶名/密碼更新web.config身份標記,或更改組策略。 請參閱以下鏈接以了解更多詳細信息。

http://forums.asp.net/t/1686842.aspx?Access+2007+Not+a+valid+password

並且這很有幫助。

當我的表單加載執行此命令時,我得到了相同的錯誤消息

    Me.LPInfoTableAdapter.Fill(Me.EduBaseDataSetLID.LPInfo)

然后我添加了以下代碼行:-

    Me.LPInfoTableAdapter.Connection.ConnectionString = dbProvider & dbSource

這是我在表單加載事件中的完整代碼:-

    'Connect to the access database
    dbProvider = "PROVIDER=Microsoft.ACE.OLEDB.12.0;"
    dbSource = "Data Source = " & dbPath & "\School Edubase\bin\EduBase.accdb;Jet OLEDB:Database Password = P@$$w0rd"

    con.ConnectionString = dbProvider & dbSource

    Me.LPInfoTableAdapter.Connection.ConnectionString = dbProvider & dbSource
    Me.LPInfoTableAdapter.Fill(Me.EduBaseDataSetLID.LPInfo)

我不是專家,甚至都不知道如何解決問題,但是我做到了。 因此,希望這對您有用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM