SqlDataAdapter Update vs Sql Insert?
Posted on 2006-10-27
I've elected to use the following C# "da.Update" code to add the contents of a shopping cart to an MS-SQL datatable named "Sales".
I'm asking in concern for the integrity of the established (preexisting) data within the SQL datatable. That is other clients sales data.
Q. Is the dataset (ds) filled with the SQL datatable data, then combinded with the session dataset (myds), then reloaded into the SQL datatable effectively overwriting the preexisting SQL datatable data...
Q. If a C# "da.Update" glitched during a shopping cart save, is there a possibility that preexisting data could become lost or corrupt?
Q. Is an SQL Insert a safer choice?
[Current Update Code]
string sql = " Select * From tbl_Sales ";
SqlConnection cn = new SqlConnection(ConfigurationManager.AppSettings["AspSql"]);
SqlDataAdapter da = new SqlDataAdapter(sql, cn);
DataSet ds = (DataSet)Session["myds"];
SqlCommandBuilder cb = new SqlCommandBuilder(da);