C # Create a DataTable via the input item

zhaozj2021-02-16  57

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 TestWebService {///

/// WebForm1 summary. /// public class WebForm1: System.Web.UI.Page {protected System.Web.UI.WebControls.Button Button1; protected System.Web.UI.WebControls.TextBox TextBox1; protected System.Web.UI. WebControls.TextBox TextBox2; protected System.Web.UI.WebControls.TextBox TextBox3; protected System.Web.UI.WebControls.TextBox TextBox4; protected System.Web.UI.WebControls.Label Label1; protected System.Web.UI.WebControls. DataGrid DataGrid1; protected System.Web.UI.WebControls.TextBox TextBox5; protected System.Web.UI.WebControls.TextBox Textbox6; private void Page_Load (object sender, System.EventArgs e) {// user code is placed here to initialize Page}

#Region Web Form Designer Generated Code Override Protected Void OnNit (Eventargs E) {// // Codegen: This call is required for the ASP.NET Web Form Designer. // InitializeComponent (); base.onit (e);} ///

/// Designer Supports the required method - Do not use the code editor to modify the // / this method. /// private () {this.button1.click = new system.eventhandler (this.button1_click); this.load = new system.eventhandler (this.page_load);

} #Endregion

private void Button1_Click (object sender, System.EventArgs e) {// get started DataTable DataTable dt = new DataTable (); string [] aryField = { "Associate", "Fieldname", "Fileldvalue", "Operate"}; string [] Aryvale = {TextBox1.text, TextBox2.text, TextBox3.text, TextBox4.text}; for (int i = 0; i

TextBox6.text = dt.columns [0] .ColumnName; TextBox5.text = dt.rows [0] ["associate"]. Tostring ();

}}}

转载请注明原文地址:https://www.9cbs.com/read-18107.html

New Post(0)