>string sSelectCommand = "select * from Customers where CustomerKey = 1"; > >SqlDataAdapter oDataAdapter = new SqlDataAdapter(sSelectCommand, oConnection); >DSCustomer oDataSet = new DSCustomer(); >oDataAdapter.Fill(oDataSet, "DSCustomer"); > >// Add a row >oDataSet.Tables[0].Rows.Add(); > >>
// If you want to change the data manually in code // Initialize your dataset and fill it. // Get the table out. DataTable dtCustomers = DataSet.Tables[0]; // or DataTable dtCustomers = DataSet.Tables["Customers"]; // Create a new row DataRow newRow = dtCustomers.NewRow(); // Edit the column values newRow["FirstName"] = "John"; newRow["LastName"] = "Jones"; // Add the row back to the table after setting all the columns dtCustomer.Rows.Add(newRow); // Call accept changes on the DataSet dsCustomers.AcceptChanges();>