This article is a mirror article of machine translation, please click here to jump to the original article.

View: 20145|Reply: 0

[Source] C# DataTable to manually add data records

[Copy link]
Posted on 5/27/2015 4:04:44 PM | | |
Record it and forget it later

  1. DataTable dt=new DataTable();
  2.             DataColumn d1=new DataColumn("书名");
  3.             DataColumn d2=new DataColumn("作者");
  4.             DataColumn d3=new DataColumn("价格");
  5.             dt.Columns.Add(d1);
  6.             dt.Columns.Add(d2);
  7.             dt.Columns.Add(d3);
  8.             DataRow dc = dt.NewRow();
  9.             dc["书名"]="java";
  10.             dc["作者"]="张山";
  11.             dc["价格"]="10";
  12.             dt.Rows.Add(dc);
  13.             GridView1.DataSource = dt;
  14.             GridView1.DataBind();
Copy code






Previous:jquery verifies that the user entered the age correctly
Next:Microsoft states: Pirate users upgrading to Win10 will watermark the desktop
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com