unspecified error problem when to insert a record into a Access DB.

.net , asp.net Ethiopia
  • 10 years ago

    Hi, all

    I am new to ASP.NET. I am testing an example that inserts a record into an access database. But i have got an error when i browse the sample aspx page from IE 7.

    In the error the line cn.open() is indentified as the source of the error.

    Line 24: 
    Line 25: 			OleDbConnection cn = new OleDbConnection(myConn);
    Line 26: 			cn.Open();
    Line 27: 			OleDbCommand cmd = new OleDbCommand(myQuery, cn);
    Line 28: 			cmd.ExecuteNonQuery();

    And the stack trace is :

    [OleDbException (0x80004005): Unspecified error]
       System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
       System.Data.OleDb.OleDbConnection.InitializeProvider() +57
       System.Data.OleDb.OleDbConnection.Open() +203
       TestASPNET.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\testaspnet\webform1.aspx.cs:26
       System.Web.UI.Control.OnLoad(EventArgs e) +67
       System.Web.UI.Control.LoadRecursive() +35
       System.Web.UI.Page.ProcessRequestMain() +731
    

    I am testing the page locally. Both .NET 1.1 and 2.0 framworks are  installed on the machine but it seems i am using 1.1 because the versioning info is:

    Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573 .

    One last thing i am using office 2007 and i think .NET framwork 2.0 installed along with it. Actually i am using Microsoft visual studio 2003 for testing my example.

    So please help me out !!

     

     

  • 10 years ago
    Hi Baye

     Where is your connection String for Access. What you have hold in the "myConn" string variable. I think that variable hold a wrong connection string.

    For the Framework problem..

    Normally if you create application in 2005 it automatically execute Framework 2.0.

    Yoy can also manually change the Framework in the IIS.

    Regads
    Hari K.....












  • 10 years ago

    Hello, Hari

    Thank you for your answer.

    I don't think there is any problem with the connection string variable. Anyway here it is:

    String myConn ="Provider=Microsoft.JET.OLEDB.4.0;Data Source=C:\\Program Files\\Microsoft Visual Studio\\VB98\\Nwind.mdb;";

    String myQuery = "Insert into Customers(CustomerID,CompanyName) Values ('aaaaa', 'aaaaa')";

    Any idea?.

    baye

     

     

  • 10 years ago

    Hi man,

    I still don't know what caused the problem. I tried the microsfot sites but didn't find anything that is understadable for me.

    SO i am waiting for you answer. or suggest me anything URL that could easly be accessable.

    thanks in advance.

    baye

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” - Antoine de Saint Exupéry