Click += new System.EventHandler(this.Button1_Click); // // sqlConnection1 // this.sqlConnection1.ConnectionString = "data source=(local);initial catalog=xr;integrated security=SSPI;persist security " + "info=False;workstation id=XURUI;packet size=4096"; // // dataSet11 // this.dataSet11.DataSetName = "DataSet1"; this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN"); this.dataSet11.Namespace = "http://www.tempuri.org/DataSet1.xsd"; // // sqlInsertCommand1 // this.sqlInsertCommand1.CommandText = "INSERT INTO store(zipcode, area, name) VALUES (@zipcode, @area, @name); SELECT zi" + "pcode, area, name FROM store"; this.sqlInsertCommand1.Connection = this.sqlConnection1; this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@zipcode", System.Data.SqlDbType.Char, 10, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "zipcode", System.Data.DataRowVersion.Current, null)); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@area", System.Data.SqlDbType.Char, 10, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "area", System.Data.DataRowVersion.Current, null)); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@name", System.Data.SqlDbType.Char, 10, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "name", System.Data.DataRowVersion.Current, null)); // // sqlSelectCommand1 // this.sqlSelectCommand1.CommandText = "SELECT zipcode, area, name FROM store "; this.sqlSelectCommand1.Connection = this.sqlConnection1; // // 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", "store", new System.Data.Common.DataColumnMapping[] {....................................
...........................
你可以根据自己的需要生成数据集。
加入新列你可以这样做:
DataTable dt;//定义一个表(废话) dt=dataSet11.Tables ["你的表"];//给表付值
DataRow dr; dr=d
|