The Page C # appears in sequence (DataTable and DataGridView improve)
:
Enter information in the textBox Control and click Add
Appears
Continue:
Code (the csdn code insertion function is useless because the inserted code addition, deletion, and modification cannot be selected, which is especially troublesome. The following code may look messy ):
// Select GrooveDataTable = new DataTable () as the creation beam form; // create nine columns of GrooveDataTable. columns. add ("name", typeof (System. string); GrooveDataTable. columns. add ("sex", typeof (System. string); GrooveDataTable. columns. add ("age", typeof (System. string); // Insert the data in MongoDB to the columns corresponding to this row (Here we store the data in MongoDB, retrieve bson before, and then foreach) foreach (BsonDocument result in resultList) {// create a row of DataRow dr = GrooveDataTable. newRow (); // row information dr [0] = Your Data dr [1] = Your Data dr [2] = Your Data // Add the above row to GrooveDataTable in the DataTable. rows. add (dr); // bind to the sorce dataGridView1.DataSource = GrooveDataTable; writable tables