看了一下强类型化的DataSet.xsd,发现这个东东还真不错,可以让程序员从复杂的繁琐的数据增,删,改中解脱出来。
看看怎么用吧:
新建立一个web工程,建立一个数据库,就access的吧,添加一个表,简单一些,几个字段就行。
在工程中添加一个.xsd文件,会提示你把它放到app_code目录下面
配置一下,利用向导,加上插入,删除等操作,完成。
在工程中添加一个页面,加一个gridview控件和object datasource,datasource控件配置,选择刚建立的xsd即可。
gridview 的datasource 中选择object datasource,运行。
系统为项目生成了这样一个文件:
#pragma checksum "F:/hooh/web/XSDTest/App_Code/hoohtest.xsd" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "8A6E9043F71E5618147B6F8B90ACCBEA"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
[Serializable()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.ComponentModel.ToolboxItem(true)]
[System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedDataSetSchema")]
[System.Xml.Serialization.XmlRootAttribute("hoohtest")]
[System.ComponentModel.Design.HelpKeywordAttribute("vs.data.DataSet")]
public partial class hoohtest : System.Data.DataSet {
private Table1DataTable tableTable1;
private System.Data.SchemaSerializationMode _schemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public hoohtest() {
this.BeginInit();
this.InitClass();
System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
base.Tables.CollectionChanged += schemaChangedHandler;
base.Relations.CollectionChanged += schemaChangedHandler;
this.EndInit();
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
protected hoohtest(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) :
base(info, context, false) {
if ((this.IsBinarySerialized(info, context) == true)) {
this.InitVars(false);
System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
this.Tables.CollectionChanged += schemaChangedHandler1;
this.Relations.CollectionChanged += schemaChangedHandler1;
return;
}
string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
if ((this.DetermineSchemaSerializationMode(info, context) == System.Data.SchemaSerializationMode.IncludeSchema)) {
System.Data.DataSet ds = new System.Data.DataSet();
ds.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
if ((ds.Tables["Table1"] != null)) {
base.Tables.Add(new Table1DataTable(ds.Tables["Table1"]));
}
this.DataSetName = ds.DataSetName;
this.Prefix = ds.Prefix;
this.Namespace = ds.Namespace;
this.Locale = ds.Locale;
this.CaseSensitive = ds.CaseSensitive;
this.EnforceConstraints = ds.EnforceConstraints;
this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
this.InitVars();
}
else {
this.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
}
this.GetSerializationData(info, context);
System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
base.Tables.CollectionChanged += schemaChangedHandler;
this.Relations.CollectionChanged += schemaChangedHandler;
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.ComponentModel.Browsable(false)]
[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)]
public Table1DataTable Table1 {
get {
return this.tableTable1;
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.ComponentModel.BrowsableAttribute(true)]
[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
public override System.Data.SchemaSerializationMode SchemaSerializationMode {
get {
return this._schemaSerializationMode;
}
set {
this._schemaSerializationMode = value;
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public new System.Data.DataTableCollection Tables {
get {
return base.Tables;
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public new System.Data.DataRelationCollection Relations {
get {
return base.Relations;
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
protected override void InitializeDerivedDataSet() {
this.BeginInit();
this.InitClass();
this.EndInit();
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public override System.Data.DataSet Clone() {
hoohtest cln = ((hoohtest)(base.Clone()));
cln.InitVars();
cln.SchemaSerializationMode = this.SchemaSerializationMode;
return cln;
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
protected override bool ShouldSerializeTables() {
return false;
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
protected override bool ShouldSerializeRelations() {
return false;
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
protected override void ReadXmlSerializable(System.Xml.XmlReader reader) {
if ((this.DetermineSchemaSerializationMode(reader) == System.Data.SchemaSerializationMode.IncludeSchema)) {
this.Reset();
System.Data.DataSet ds = new System.Data.DataSet();
ds.ReadXml(reader);
if ((ds.Tables["Table1"] != null)) {
base.Tables.Add(new Table1DataTable(ds.Tables["Table1"]));
}
this.DataSetName = ds.DataSetName;
this.Prefix = ds.Prefix;
this.Namespace = ds.Namespace;
this.Locale = ds.Locale;
this.CaseSensitive = ds.CaseSensitive;
this.EnforceConstraints = ds.EnforceConstraints;
this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
this.InitVars();
}
else {
this.ReadXml(reader);
this.InitVars();
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
protected override System.Xml.Schema.XmlSchema GetSchemaSerializable() {
System.IO.MemoryStream stream = new System.IO.MemoryStream();
this.WriteXmlSchema(new System.Xml.XmlTextWriter(stream, null));
stream.Position = 0;
return System.Xml.Schema.XmlSchema.Read(new System.Xml.XmlTextReader(stream), null);
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal void InitVars() {
this.InitVars(true);
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal void InitVars(bool initTable) {
this.tableTable1 = ((Table1DataTable)(base.Tables["Table1"]));
if ((initTable == true)) {
if ((this.tableTable1 != null)) {
this.tableTable1.InitVars();
}
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
private void InitClass() {
this.DataSetName = "hoohtest";
this.Prefix = "";
this.Namespace = "http://tempuri.org/hoohtest.xsd";
this.EnforceConstraints = true;
this.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
this.tableTable1 = new Table1DataTable();
base.Tables.Add(this.tableTable1);
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
private bool ShouldSerializeTable1() {
return false;
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
private void SchemaChanged(object sender, System.ComponentModel.CollectionChangeEventArgs e) {
if ((e.Action == System.ComponentModel.CollectionChangeAction.Remove)) {
this.InitVars();
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(System.Xml.Schema.XmlSchemaSet xs) {
hoohtest ds = new hoohtest();
System.Xml.Schema.XmlSchemaComplexType type = new System.Xml.Schema.XmlSchemaComplexType();
System.Xml.Schema.XmlSchemaSequence sequence = new System.Xml.Schema.XmlSchemaSequence();
xs.Add(ds.GetSchemaSerializable());
System.Xml.Schema.XmlSchemaAny any = new System.Xml.Schema.XmlSchemaAny();
any.Namespace = ds.Namespace;
sequence.Items.Add(any);
type.Particle = sequence;
return type;
}
public delegate void Table1RowChangeEventHandler(object sender, Table1RowChangeEvent e);
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
[System.Serializable()]
[System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")]
public partial class Table1DataTable : System.Data.DataTable, System.Collections.IEnumerable {
private System.Data.DataColumn columnAutoId;
private System.Data.DataColumn columnName;
private System.Data.DataColumn columnAddress;
private System.Data.DataColumn columnTel;
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public Table1DataTable() {
this.TableName = "Table1";
this.BeginInit();
this.InitClass();
this.EndInit();
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal Table1DataTable(System.Data.DataTable table) {
this.TableName = table.TableName;
if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
this.CaseSensitive = table.CaseSensitive;
}
if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
this.Locale = table.Locale;
}
if ((table.Namespace != table.DataSet.Namespace)) {
this.Namespace = table.Namespace;
}
this.Prefix = table.Prefix;
this.MinimumCapacity = table.MinimumCapacity;
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
protected Table1DataTable(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) :
base(info, context) {
this.InitVars();
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public System.Data.DataColumn AutoIdColumn {
get {
return this.columnAutoId;
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public System.Data.DataColumn NameColumn {
get {
return this.columnName;
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public System.Data.DataColumn AddressColumn {
get {
return this.columnAddress;
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public System.Data.DataColumn TelColumn {
get {
return this.columnTel;
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.ComponentModel.Browsable(false)]
public int Count {
get {
return this.Rows.Count;
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public Table1Row this[int index] {
get {
return ((Table1Row)(this.Rows[index]));
}
}
public event Table1RowChangeEventHandler Table1RowChanging;
public event Table1RowChangeEventHandler Table1RowChanged;
public event Table1RowChangeEventHandler Table1RowDeleting;
public event Table1RowChangeEventHandler Table1RowDeleted;
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void AddTable1Row(Table1Row row) {
this.Rows.Add(row);
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public Table1Row AddTable1Row(string Name, string Address, string Tel) {
Table1Row rowTable1Row = ((Table1Row)(this.NewRow()));
rowTable1Row.ItemArray = new object[] {
null,
Name,
Address,
Tel};
this.Rows.Add(rowTable1Row);
return rowTable1Row;
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public Table1Row FindByAutoId(int AutoId) {
return ((Table1Row)(this.Rows.Find(new object[] {
AutoId})));
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public virtual System.Collections.IEnumerator GetEnumerator() {
return this.Rows.GetEnumerator();
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public override System.Data.DataTable Clone() {
Table1DataTable cln = ((Table1DataTable)(base.Clone()));
cln.InitVars();
return cln;
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
protected override System.Data.DataTable CreateInstance() {
return new Table1DataTable();
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal void InitVars() {
this.columnAutoId = base.Columns["AutoId"];
this.columnName = base.Columns["Name"];
this.columnAddress = base.Columns["Address"];
this.columnTel = base.Columns["Tel"];
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
private void InitClass() {
this.columnAutoId = new System.Data.DataColumn("AutoId", typeof(int), null, System.Data.MappingType.Element);
base.Columns.Add(this.columnAutoId);
this.columnName = new System.Data.DataColumn("Name", typeof(string), null, System.Data.MappingType.Element);
base.Columns.Add(this.columnName);
this.columnAddress = new System.Data.DataColumn("Address", typeof(string), null, System.Data.MappingType.Element);
base.Columns.Add(this.columnAddress);
this.columnTel = new System.Data.DataColumn("Tel", typeof(string), null, System.Data.MappingType.Element);
base.Columns.Add(this.columnTel);
this.Constraints.Add(new System.Data.UniqueConstraint("Constraint1", new System.Data.DataColumn[] {
this.columnAutoId}, true));
this.columnAutoId.AutoIncrement = true;
this.columnAutoId.AllowDBNull = false;
this.columnAutoId.Unique = true;
this.columnName.MaxLength = 50;
this.columnAddress.MaxLength = 50;
this.columnTel.MaxLength = 50;
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public Table1Row NewTable1Row() {
return ((Table1Row)(this.NewRow()));
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
protected override System.Data.DataRow NewRowFromBuilder(System.Data.DataRowBuilder builder) {
return new Table1Row(builder);
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
protected override System.Type GetRowType() {
return typeof(Table1Row);
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
protected override void OnRowChanged(System.Data.DataRowChangeEventArgs e) {
base.OnRowChanged(e);
if ((this.Table1RowChanged != null)) {
this.Table1RowChanged(this, new Table1RowChangeEvent(((Table1Row)(e.Row)), e.Action));
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
protected override void OnRowChanging(System.Data.DataRowChangeEventArgs e) {
base.OnRowChanging(e);
if ((this.Table1RowChanging != null)) {
this.Table1RowChanging(this, new Table1RowChangeEvent(((Table1Row)(e.Row)), e.Action));
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
protected override void OnRowDeleted(System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleted(e);
if ((this.Table1RowDeleted != null)) {
this.Table1RowDeleted(this, new Table1RowChangeEvent(((Table1Row)(e.Row)), e.Action));
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
protected override void OnRowDeleting(System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleting(e);
if ((this.Table1RowDeleting != null)) {
this.Table1RowDeleting(this, new Table1RowChangeEvent(((Table1Row)(e.Row)), e.Action));
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void RemoveTable1Row(Table1Row row) {
this.Rows.Remove(row);
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(System.Xml.Schema.XmlSchemaSet xs) {
System.Xml.Schema.XmlSchemaComplexType type = new System.Xml.Schema.XmlSchemaComplexType();
System.Xml.Schema.XmlSchemaSequence sequence = new System.Xml.Schema.XmlSchemaSequence();
hoohtest ds = new hoohtest();
xs.Add(ds.GetSchemaSerializable());
System.Xml.Schema.XmlSchemaAny any1 = new System.Xml.Schema.XmlSchemaAny();
any1.Namespace = "http://www.w3.org/2001/XMLSchema";
any1.MinOccurs = new decimal(0);
any1.MaxOccurs = decimal.MaxValue;
any1.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax;
sequence.Items.Add(any1);
System.Xml.Schema.XmlSchemaAny any2 = new System.Xml.Schema.XmlSchemaAny();
any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
any2.MinOccurs = new decimal(1);
any2.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax;
sequence.Items.Add(any2);
System.Xml.Schema.XmlSchemaAttribute attribute1 = new System.Xml.Schema.XmlSchemaAttribute();
attribute1.Name = "namespace";
attribute1.FixedValue = ds.Namespace;
type.Attributes.Add(attribute1);
System.Xml.Schema.XmlSchemaAttribute attribute2 = new System.Xml.Schema.XmlSchemaAttribute();
attribute2.Name = "tableTypeName";
attribute2.FixedValue = "Table1DataTable";
type.Attributes.Add(attribute2);
type.Particle = sequence;
return type;
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
public partial class Table1Row : System.Data.DataRow {
private Table1DataTable tableTable1;
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal Table1Row(System.Data.DataRowBuilder rb) :
base(rb) {
this.tableTable1 = ((Table1DataTable)(this.Table));
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public int AutoId {
get {
return ((int)(this[this.tableTable1.AutoIdColumn]));
}
set {
this[this.tableTable1.AutoIdColumn] = value;
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public string Name {
get {
try {
return ((string)(this[this.tableTable1.NameColumn]));
}
catch (System.InvalidCastException e) {
throw new System.Data.StrongTypingException("The value for column /'Name/' in table /'Table1/' is DBNull.", e);
}
}
set {
this[this.tableTable1.NameColumn] = value;
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public string Address {
get {
try {
return ((string)(this[this.tableTable1.AddressColumn]));
}
catch (System.InvalidCastException e) {
throw new System.Data.StrongTypingException("The value for column /'Address/' in table /'Table1/' is DBNull.", e);
}
}
set {
this[this.tableTable1.AddressColumn] = value;
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public string Tel {
get {
try {
return ((string)(this[this.tableTable1.TelColumn]));
}
catch (System.InvalidCastException e) {
throw new System.Data.StrongTypingException("The value for column /'Tel/' in table /'Table1/' is DBNull.", e);
}
}
set {
this[this.tableTable1.TelColumn] = value;
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public bool IsNameNull() {
return this.IsNull(this.tableTable1.NameColumn);
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void SetNameNull() {
this[this.tableTable1.NameColumn] = System.Convert.DBNull;
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public bool IsAddressNull() {
return this.IsNull(this.tableTable1.AddressColumn);
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void SetAddressNull() {
this[this.tableTable1.AddressColumn] = System.Convert.DBNull;
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public bool IsTelNull() {
return this.IsNull(this.tableTable1.TelColumn);
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void SetTelNull() {
this[this.tableTable1.TelColumn] = System.Convert.DBNull;
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
public class Table1RowChangeEvent : System.EventArgs {
private Table1Row eventRow;
private System.Data.DataRowAction eventAction;
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public Table1RowChangeEvent(Table1Row row, System.Data.DataRowAction action) {
this.eventRow = row;
this.eventAction = action;
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public Table1Row Row {
get {
return this.eventRow;
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public System.Data.DataRowAction Action {
get {
return this.eventAction;
}
}
}
}
namespace hoohtestTableAdapters {
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.ComponentModel.ToolboxItem(true)]
[System.ComponentModel.DataObjectAttribute(true)]
[System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" +
", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public partial class Table1TableAdapter : System.ComponentModel.Component {
private System.Data.OleDb.OleDbDataAdapter _adapter;
private System.Data.OleDb.OleDbConnection _connection;
private System.Data.OleDb.OleDbCommand[] _commandCollection;
private bool _clearBeforeFill;
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public Table1TableAdapter() {
this.ClearBeforeFill = true;
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
private System.Data.OleDb.OleDbDataAdapter Adapter {
get {
if ((this._adapter == null)) {
this.InitAdapter();
}
return this._adapter;
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal System.Data.OleDb.OleDbConnection Connection {
get {
if ((this._connection == null)) {
this.InitConnection();
}
return this._connection;
}
set {
this._connection = value;
if ((this.Adapter.InsertCommand != null)) {
this.Adapter.InsertCommand.Connection = value;
}
if ((this.Adapter.DeleteCommand != null)) {
this.Adapter.DeleteCommand.Connection = value;
}
if ((this.Adapter.UpdateCommand != null)) {
this.Adapter.UpdateCommand.Connection = value;
}
for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
if ((this.CommandCollection[i] != null)) {
((System.Data.OleDb.OleDbCommand)(this.CommandCollection[i])).Connection = value;
}
}
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
protected System.Data.OleDb.OleDbCommand[] CommandCollection {
get {
if ((this._commandCollection == null)) {
this.InitCommandCollection();
}
return this._commandCollection;
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public bool ClearBeforeFill {
get {
return this._clearBeforeFill;
}
set {
this._clearBeforeFill = value;
}
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
private void InitAdapter() {
this._adapter = new System.Data.OleDb.OleDbDataAdapter();
System.Data.Common.DataTableMapping tableMapping = new System.Data.Common.DataTableMapping();
tableMapping.SourceTable = "Table";
tableMapping.DataSetTable = "Table1";
tableMapping.ColumnMappings.Add("AutoId", "AutoId");
tableMapping.ColumnMappings.Add("Name", "Name");
tableMapping.ColumnMappings.Add("Address", "Address");
tableMapping.ColumnMappings.Add("Tel", "Tel");
this._adapter.TableMappings.Add(tableMapping);
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
private void InitConnection() {
this._connection = new System.Data.OleDb.OleDbConnection();
this._connection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["db1ConnectionString"].ConnectionString;
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
private void InitCommandCollection() {
this._commandCollection = new System.Data.OleDb.OleDbCommand[1];
this._commandCollection[0] = new System.Data.OleDb.OleDbCommand();
this._commandCollection[0].Connection = this.Connection;
this._commandCollection[0].CommandText = "SELECT AutoId, Name, Address, Tel/r/nFROM Table1/r/nWHERE " +
" (AutoId = ?)";
this._commandCollection[0].CommandType = System.Data.CommandType.Text;
this._commandCollection[0].Parameters.Add(new System.Data.OleDb.OleDbParameter("AutoId", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, ((byte)(0)), ((byte)(0)), "AutoId", System.Data.DataRowVersion.Current, false, null));
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
public virtual hoohtest.Table1DataTable GetData22222(int AutoId) {
this.Adapter.SelectCommand = this.CommandCollection[0];
this.Adapter.SelectCommand.Parameters[0].Value = ((int)(AutoId));
hoohtest.Table1DataTable dataTable = new hoohtest.Table1DataTable();
this.Adapter.Fill(dataTable);
return dataTable;
}
}
}