C
Cybertof
Hello,
Is it necessary to initially fill a dataset to be able to add a new row
to the dataset and then update the undercover database ?
(In the case of a very large database, this would mean that all the
database content should be loaded before beeing able to add a new row,
and i don't want to load anything...)
Is it possible in the following code to remove the
"// CAN THIS BE REMOVED ?"
line ?
Sample Code :
**************
public static void Main() {
SqlConnection myConn = new SqlConnection("...");
SqlCommand myCommand = new SqlCommand( "Select * from Company", myConn);
OleDbDataAdapter myDA = new OleDbDataAdapter(myCommand);
DataSet myDS = new DataSet();
myDA.Fill(myDS, "Companies"); // CAN THIS BE REMOVED ?
DataRow myRow = myDS.Tables["Companies"].NewRow();
myRow["CompanyName"] = "Widget Corp.";
myRow["StockSymb"] = "WID";
myDS.Tables["Companies"].Rows.Add(myRow);
OleDbCommandBuilder mBuild = new OleDbCommandBuilder(myDA);
myDA.Update(myDS, "Companies");
}
Is it necessary to initially fill a dataset to be able to add a new row
to the dataset and then update the undercover database ?
(In the case of a very large database, this would mean that all the
database content should be loaded before beeing able to add a new row,
and i don't want to load anything...)
Is it possible in the following code to remove the
"// CAN THIS BE REMOVED ?"
line ?
Sample Code :
**************
public static void Main() {
SqlConnection myConn = new SqlConnection("...");
SqlCommand myCommand = new SqlCommand( "Select * from Company", myConn);
OleDbDataAdapter myDA = new OleDbDataAdapter(myCommand);
DataSet myDS = new DataSet();
myDA.Fill(myDS, "Companies"); // CAN THIS BE REMOVED ?
DataRow myRow = myDS.Tables["Companies"].NewRow();
myRow["CompanyName"] = "Widget Corp.";
myRow["StockSymb"] = "WID";
myDS.Tables["Companies"].Rows.Add(myRow);
OleDbCommandBuilder mBuild = new OleDbCommandBuilder(myDA);
myDA.Update(myDS, "Companies");
}