ConnectionString from webconfig file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yogarajan
    New Member
    • Apr 2007
    • 115

    ConnectionString from webconfig file

    this is my code
    Code:
    string txt1 = TextBox1.Text;
            DateTime txt2 = Convert.ToDateTime(TextBox2.Text);
            
            DataSet1TableAdapters.userdetailsTableAdapter useradapter = new DataSet1TableAdapters.userdetailsTableAdapter();
            System.Data.SqlClient.SqlTransaction tr;
            
            
            try
            {
                useradapter.InsertQuery(txt1, txt2);
                tr.Commit();
            }
            catch
            {
                tr.Rollback();
            }
    database connnection am using web.config file

    here i want use transaction begins and commit and rollback options

    anyone know abt this code

    pls quide me

    Thanks
  • PRR
    Recognized Expert Contributor
    • Dec 2007
    • 750

    #2
    Look into this e.g....

    Comment

    • yogarajan
      New Member
      • Apr 2007
      • 115

      #3
      Originally posted by DeepBlue
      Look into this e.g....
      Thanks for ur example

      but am using connection through web.config file so i am not using sql connection string see my code

      i need sample for connection through web.config

      Please guide me

      Thanks

      Comment

      • PRR
        Recognized Expert Contributor
        • Dec 2007
        • 750

        #4
        You need to specify what exactly you are asking ... From your question it looks like you want to know about Transaction commit and rollback...
        As for your question you can use
        Code:
        ConfigurationManager.AppSettings["keyname"]
        
        ConfigurationManager.ConnectionStrings["connectionsstring"].ConnectionString
        ConfigurationMa nager.AppSettin gs


        ConfigurationMa nager.Connectio nStrings

        Comment

        Working...