No error information available: DB_SEC_E_AUTH_FAILED(0x80040E4D)???

D

Dianne

I have recieved this error message when trying to open a connection to
an access database. What I don't understand is why earlier in the
submit_click method the connection opened properly, yet in the
loadTable method it throws the error "No error information available:
DB_SEC_E_AUTH_FAILED(0x80040E4D)". I have included my code to help
visualize what I am tryin to to.

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;

namespace dynamicAccess
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
//declares the object that are in the web application
protected System.Data.OleDb.OleDbCommand oleDbCommand1;
protected System.Web.UI.WebControls.Button Submit;
protected System.Data.OleDb.OleDbConnection myConnection;
protected System.Web.UI.WebControls.Button LoadTable;
protected System.Web.UI.WebControls.DropDownList DropDownList;
protected System.Web.UI.HtmlControls.HtmlInputFile File1;
protected System.Web.UI.WebControls.DataGrid DataGrid1;


private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.myConnection = new System.Data.OleDb.OleDbConnection();
this.oleDbCommand1 = new System.Data.OleDb.OleDbCommand();
this.Submit.Click += new System.EventHandler(this.Submit_Click);
this.LoadTable.Click += new
System.EventHandler(this.LoadTable_Click);
//
// myConnection
//
this.myConnection.ConnectionString = @"Jet OLEDB:Global Partial
Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking
Mode=1;Mode=Share Deny None;Jet OLEDB:Engine
Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System
database=;Jet OLEDB:SFP=False;persist security info=False;Extended
Properties=;Jet OLEDB:Compact Without Replica Repair=False;Jet
OLEDB:Encrypt Database=False;Jet OLEDB:Create System
Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;User
ID=Admin;Jet OLEDB:Global Bulk Transactions=1";
this.Load += new System.EventHandler(this.Page_Load);
//
// oleDbCommand1
//
this.oleDbCommand1.CommandText = "SELECT * FROM";
this.oleDbCommand1.Connection = this.myConnection;

}
#endregion

/* after the user finds the database they wish to open they must hit
the submit button to
* populate the dropdownlist. The Submit_Click populates the drop
down list and updates
* the command text.*/

private void Submit_Click(object sender, System.EventArgs e)
{
myConnection.ConnectionString += ";Data Source=" +
File1.PostedFile.FileName;
myConnection.Open();
DataTable schemaTable =
myConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,
new object[] {null,null,null,"TABLE"});
myConnection.Close();

DropDownList.DataSource=schemaTable;
DropDownList.DataTextField = "TABLE_NAME";
DropDownList.DataValueField = "TABLE_NAME";
DropDownList.SelectedIndex = DropDownList.SelectedIndex;
DropDownList.DataBind();
DropDownList.Items.Insert(0, new ListItem("Select a Table"));
DropDownList.SelectedIndex = 0;

oleDbCommand1.CommandText += " " + DropDownList.SelectedItem.Text;

}

/* This event fills the data grid so that the user can see the
contents of the table selected.
* At this time I am recieving an error when trying to open the
connection.
* (No error information available:
DB_SEC_E_AUTH_FAILED(0x80040E4D))*/
private void LoadTable_Click(object sender, System.EventArgs e)
{
myConnection.Open();
System.Data.OleDb.OleDbDataReader Reader;
Reader = oleDbCommand1.ExecuteReader();
DataGrid1.DataSource = Reader;
DataGrid1.DataBind();
Reader.Close();
myConnection.Close();
}

}
}
 
D

Dianne

I figured out what was going on. The file name I was trying to open
was not being saved in between postbacks. Therefore the the data
source was recieving an empty string.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top