新开工第一个测试

// 在此处放置用户代码以初始化页面
if ( ! Page.IsPostBack)
... {
SqlConnectionconn
=newSqlConnection();
conn.ConnectionString
="InitialCatalog=pubs;DataSource=.;UserId=sa;Password=dotnet";
SqlCommandcmd
=newSqlCommand();
cmd.Connection
=conn;
cmd.CommandText
="select*fromtitles";
SqlDataAdapterda
=newSqlDataAdapter();
da.SelectCommand
=cmd;
DataSetds
=newDataSet();
da.Fill(ds);
this.DataGrid1.DataSource=ds.Tables[0];
this.DataGrid1.DataBind();
this.DataGrid2.DataSource=this.DataGrid1.DataSource;
this.DataGrid2.DataBind();

}

你可能感兴趣的:(测试)