sql链接(c#)

SqlConnection con;
        SqlDataAdapter adaptcommand;
        string strconnect;
        string strcommand;
        DataSet dataset1=new DataSet();
        strconnect="Data Source=.\\sqlexpress;Initial Catalog=db_test;Integrated Security=True;Pooling=False";
        strcommand="select * from dt_test";
       
        adaptcommand=new SqlDataAdapter(strcommand,strconnect);

        adaptcommand.Fill(dataset1,"data");
        GridView3.DataSource = dataset1.Tables["data"];
        GridView3.DataBind();

posted @ 2009-09-15 18:30  luck_net  阅读(305)  评论(1编辑  收藏  举报