这是cs源码
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace asp2
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;
protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;
protected System.Data.SqlClient.SqlConnection sqlConnection1;
protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected asp2.DataSet1 dataSet11;
private void BindGrid()
{this.sqlDataAdapter1.Fill(this.dataSet11);
this.DataGrid1.DataBind();
}
private void Page_Load(object sender, System.EventArgs e)
{
if(IsPostBack)
return;
BindGrid();// 在此处放置用户代码以初始化页面
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.dataSet11 = new asp2.DataSet1();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT s4, s5 FROM s";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO s(s4, s5) VALUES (@s4, @s5); SELECT s4, s5 FROM s";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@s4", System.Data.SqlDbType.VarChar, 10, "s4"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@s5", System.Data.SqlDbType.VarChar, 10, "s5"));
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "data source=FZQCOM;initial catalog=DevMIS;integrated security=SSPI;persist securi" +
"ty info=False;user id=sa;workstation id=FZQCOM;packet size=4096";
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "s", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("s4", "s4"),
new System.Data.Common.DataColumnMapping("s5", "s5")})});
//
// dataSet11
//
this.dataSet11.DataSetName = "DataSet1";
this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
this.dataSet11.Namespace = "http://www.tempuri.org/DataSet1.xsd";
this.Load += new System.EventHandler(this.Page_Load);
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
}
#endregion
}
}