为什么更新不了
//以下执行删除操作
OleDbConnection MyConn;
MyConn = new OleDbConnection(ConfigurationManager.AppSettings["myconnstring"].ToString() + System.Web.HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["mydbpath"]));
MyConn.Open();
if (dgIDs.Length > 1)
{
String strsql = "update Photos set IsDel=1 where Id in (" + dgIDs.Substring(0, dgIDs.LastIndexOf(",")) + ")";
OleDbCommand myCommend = new OleDbCommand(strsql, MyConn);
myCommend.ExecuteNonQuery();
string cmdText = "SELECT * FROM Photos where IsDel=false ORDER BY Id DESC";
OleDbDataAdapter da = new OleDbDataAdapter(cmdText, MyConn);
DataSet ds = new DataSet();
da.Fill(ds, "Photos");
DataList1.DataSource = ds.Tables["Photos"].DefaultView;
DataList1.DataBind();
RecordCount.Text = ds.Tables[0].Rows.Count.ToString();
//int from = Int32.Parse(lblCurrentpage.Text.ToString()) - 1;
}
为什么我删除了也重新绑定了,页面还是会显示删除掉的数据,一定要重新刷新才消失