// initialise
DataTable dt = new DataTable();
dt.TableName = "foo";
// add meta data
DataColumn col = dtColumns.Add("CustID", typeof(Int32));
DataColumn col = dtColumns.Add("Name", typeof(String));
// insert row
DataRow row = dt.NewRow();
row["CustID"] = 1;
row["Name"] = "bar";
dt.Rows.Add(row); // alt method: dt.Rows.Add(new Object[] {1, "bar"});
Created
September 17, 2013 11:58
-
-
Save booyaa/6593372 to your computer and use it in GitHub Desktop.
Create a datatable with columns and insert rows
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment