G
gigs
string strConn, strSQL;
strConn = @"Data Source=Gigs-PC;Initial Catalog=Northwind;Integrated
Security=True;";
strSQL = "SELECT OrderID, CustomerID FROM Orders";
SqlDataAdapter da = new SqlDataAdapter(strSQL, strConn);
DataSet ds = new DataSet();
DataTable tbl = ds.Tables.Add("Customers");
DataColumn col = tbl.Columns.Add("CustomerID");
DataColumn col1 = tbl.Columns.Add("OrderID");
DataRow row = tbl.Rows.Add("10");
DataRow row1 = tbl.Rows.Add("11");
DataRow row2 = col1.Table.Rows.Add("11");
foreach (DataRow roww in tbl.Rows)
Console.WriteLine(roww["CustomerID"]);
foreach (DataRow roww in tbl.Rows)
Console.WriteLine(roww["OrderID"]);
How I can add rows to OrderID column? Why is this code only adding rows to
CustomerID?
thanks!
strConn = @"Data Source=Gigs-PC;Initial Catalog=Northwind;Integrated
Security=True;";
strSQL = "SELECT OrderID, CustomerID FROM Orders";
SqlDataAdapter da = new SqlDataAdapter(strSQL, strConn);
DataSet ds = new DataSet();
DataTable tbl = ds.Tables.Add("Customers");
DataColumn col = tbl.Columns.Add("CustomerID");
DataColumn col1 = tbl.Columns.Add("OrderID");
DataRow row = tbl.Rows.Add("10");
DataRow row1 = tbl.Rows.Add("11");
DataRow row2 = col1.Table.Rows.Add("11");
foreach (DataRow roww in tbl.Rows)
Console.WriteLine(roww["CustomerID"]);
foreach (DataRow roww in tbl.Rows)
Console.WriteLine(roww["OrderID"]);
How I can add rows to OrderID column? Why is this code only adding rows to
CustomerID?
thanks!