>DSCustomer oDataSet = new DSCustomer(); > >oDataSet.Tables[0].Rows.Add(); > >DataTable oTable = oDataSet.Tables[0]; > >int iRowCount = oTable.Rows.Count - 1; > >DataRow oRow = oTable.Rows[iRowCount]; > >oRow["CustomerName"] = "Millard Filmore"; >oRow["CreditLimit"] = 2520; > >SqlCommandBuilder oBuilder = new SqlCommandBuilder(oDataAdapter); > >oDataAdapter.Update(oDataSet, oDataSet.Tables[0].TableName); >>
>string sSelectCommand = "select * from Customers where CustomerKey = 1"; >SqlDataAdapter oDataAdapter = new SqlDataAdapter(sSelectCommand, oConnection); >>
>>>/***************************************************** >>> * Get the customer record >>>******************************************************/ >>> >>>string sSelectCommand = "select * from Customers where CustomerKey = 1"; >>> >>>SqlDataAdapter oDataAdapter = new SqlDataAdapter(sSelectCommand, oConnection); >>>DSCustomer oDataSet = new DSCustomer(); >>>oDataAdapter.Fill(oDataSet, "DSCustomer"); >>> >>>/***************************************************** >>> * Or Create a new blank data set record >>>******************************************************/ >>>//DSCustomer oDataSet = new DSCustomer(); >>> >>>// Add a blank row >>>oDataSet.Tables[0].Rows.Add(); >>> >>> >>>// Get a reference to the table >>>DataTable oTable = oDataSet.Tables[0]; >>> >>>// Get the number of rows >>>int iRowCount = oTable.Rows.Count - 1; >>> >>>// Get a reference to the new row >>>DataRow oRow = oTable.Rows[iRowCount]; >>> >>>// Edit the column values >>>oRow["CustomerName"] = "Someone Else"; >>>oRow["CreditLimit"] = 15; >>> >>>// Save the changes to the dataset >>>oDataSet.AcceptChanges(); >>> >>>// Create a command builder. >>>SqlCommandBuilder oBuilder = new SqlCommandBuilder(oDataAdapter); >>> >>>// Update the changes to the backend >>>oDataAdapter.Update(oDataSet, oDataSet.Tables[0].TableName); >>> >>>>>