public void Bind()
{
try
{
string strSql = "select Sex from dboStudent group by Sex";
SqlCommand cmd = new SqlCommand(strSql, DBHelpperconn);
DBHelpperconnOpen();
SqlDataReader dataReader = cmdExecuteReader();
string sex = "";
while (dataReaderRead())
{
sex = (string)dataReader[0];
cboSexItemsAdd(sex);
}
dataReaderClose();
}
catch (Exception ex)
{
MessageBoxShow(" *** 作数据库出错");
ConsoleWriteLine(exMessage);
}
finally
{
DBHelpperconnClose();
}
string StrSql = "select StudentID,LoginId,StudentName,StudentNO,Sex,Phone,Address,JobWanted from dboStudent";
dataAdapter = new SqlDataAdapter(StrSql,DBHelpperconn);
dataAdapterFill(dataSet, "Student");
dgvStudentDataSource = dataSetTables["Student"];
}
然后在Form_load与刷新按钮里调用此方法
Bind()
然后在修改事件里的下后面调用Bind()方法,即修改完毕就刷新,不用再点刷新按钮简单回答:自己看,不再赘述
用iframe、d出子页面刷新父页面
iframe
parentlocationreload();
d出子页面
windowopenerlocationreload();
子窗口刷新父窗口
selfwindowopenerlocactionreload();
刷新一open()方法打开的窗口
windowopenerlocationhref = windowopenerlocationhref
刷新以winodwshowModelDialog()方法打开的窗口
windowparentdialogArgumentsdocumentexecCommand('Refresh');
或
ResponseWrite("<script>windowlocationhref = windowlocationhref</script>");
刷新本页ResponseWrite("<script>windowlocationhref=windowlocationhref; </script>");
刷新父页和本页面:
ResponseWrite("<script>alert('提交成功!');windowlocationhref=windowlocationhref;windowopenerlocation=windowopenerlocation;</script>");
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)