数据表中删除记录 避免用 Delete 应单独设置字段,防止误删 private void DeleteProductInfo( int TempID){ SqlConnection con = null ; bool flag = false ; try {con = new SqlConnection(ConfigurationManager.AppSettings[ “ConnectionString” ]); string
数据表中删除记录 避免用 Delete 应单独设置字段,防止误删
private void DeleteProductInfo(int TempID){ SqlConnection 本文来源gao($daima.com搞@代@#码(网5con = null; bool flag = false; try {con = new SqlConnection(ConfigurationManager.AppSettings[“ConnectionString”]);string sql = “update T_Temp set Deleted=1 where TempID=” + TempID;con.Open();SqlCommand com = new SqlCommand(sql, con);flag = com.ExecuteNonQuery() > 0 ? true : false;con.Close(); } catch (SqlException se) { } finally {con.Close(); } if (flag) {myShare.WebMessageBox(this.Page, “删除成功!”); } else {myShare.WebMessageBox(this.Page, “删除信息时出错,请重试!”); }}
posted on
Copyright ©2013 porray Powered By: 博客园 模板提供:沪江博客
,