Fork me on GitHub

我喜欢的经典dataset测试数据库

1.配置web.config

<appSettings>
        <add key="ConnectionString" value="server=(local);uid=sa;pwd=;database=db_InformationDepartment" />
    </appSettings>

2.测试数据库

        SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
        string mysql = " select * from tb_DynamicInfo";
        conn.Open();
        SqlDataAdapter dap = new SqlDataAdapter(mysql, conn);
        DataSet ds = new DataSet();
        dap.Fill(ds);
        conn.Close();
        GridView1.DataSource = ds;
        GridView1.DataBind();

posted @ 2008-09-17 19:00  idoku  阅读(483)  评论(8编辑  收藏  举报