C#,sql2005 connectivity error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • senthilnova
    New Member
    • Nov 2007
    • 7

    C#,sql2005 connectivity error

    hi,
    i am beginner in C#. i got an error in connecting with sqlserver2005 as"
    "The connection string property has not been initialized". I wrote the connection settings for a button click event as

    Code:
    private void button1_Click(object sender, EventArgs e)
            {
                string str = "Data Source='sen-1;Initial Catalog=test1;Integrated Security=True;Pooling=False";
                SqlConnection conn;
                SqlDataAdapter da;
                DataSet ds=new DataSet();
                string qry ="select * from test1";
    
                conn = new SqlConnection(str);
                da = new SqlDataAdapter(qry, conn);
                da.Fill(ds);
                textBox1.Text=ds.Tables(0).rows(0).columns(0);
    
    
            }
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Hi senthilnovaI

    Welcome to TSDN.

    As this section is only for introduction of the new members, feel free to post questions in the related forum only by choosing from under the blue bar on the top of your page.

    But before that give a try from your side and if possible try to post what/how you have approached to solve the problem.

    It will help Experts in the forum in solving / underestanding your problem in a better way.

    Please follow the posting guidelines in every new post/reply.

    Please specify your post/question clearly.Please use proper code tags in all your codes.

    Regards

    Debasis

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      Do you need to call Open() on your db connection first?

      Comment

      Working...