can anybody tell me the provider name

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • furqi
    New Member
    • Dec 2009
    • 21

    can anybody tell me the provider name

    following is the code that i am calling in my button event i am actually making a table and the the data that is entered is actually saving in my "book.mdf" table
    the error that i am getting is that "unrecognis ed database" it is i think most probably due to the wrong provider name that i am giving i actually dont know the provider name

    here is the code

    Code:
    // set Access connection and select strings
                string strDSN = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                " Data Source=D:/asp.net apps/application/App_Data/book.mdf";
                string strSQL = "INSERT INTO book " +
                "( Name,Address,Email,Comments)" +
                "VALUES ('" + NAMETextBox.Text.ToString() + " ',' "
                + ADDRESSTextBox.Text.ToString() + " ', '"
                + EMAILTextBox.Text.ToString()
                + " ',' " + COMMENTTextBox.Text.ToString() + " ')";
    
                 // Create oleDbDataAdapter
                OleDbConnection myConn = new OleDbConnection(strDSN);
    
                 //Create ole Db Command And call ExecuteNonQuery to execute
                 // a SQL statement
                OleDbCommand myCmd = new OleDbCommand(strSQL, myConn);
                 try
                {
                    myConn.Open();
                     myCmd.ExecuteNonQuery();
                }
                catch (Exception exp)
                {
                    Console.WriteLine("Error: {0}", exp.Message);
                }
                myConn.Close();
                 // open Thans.aspx page after adding entries to the guest book
                Response.Redirect("thanxx.aspx");
             }
    i shallbe very thankful to ya if you help me out in this matter
    regards furqan ahmed a.k.a furqi
    thanxxx
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Check out Connection String Syntax (ADO.NET) to make sure that you've created a proper connection string.

    -Frinny

    Comment

    Working...