[WebMethod] public bool SecureUpdateDataSet(DataSet delta) { string connStr = WebConfigurationManager.ConnectionStrings["Employees"].ConnectionString; using(var conn = new SqlConnection(connStr)) { conn.Open(); string sql = "select * from tab1 where 1 = 0"; var da = new SqlDataAdapter(sql, conn); var builder = new SqlCommandBuilder(ad); da.InsertCommand = builder.GetInsertCommand(); da.UpdateCommand = builder.GetUpdateCommand(); da.DeleteCommand = builder.GetDeleteCommand(); da.Update(delta); return true; } return false; }
"Simplicity can't be bought later, it must be earned from the start" -- DB
Sunday, March 28, 2010
Updating a Data Source with a Dataset
my answer on stackoverflow question Updating a Data Source with a Dataset:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment