方法如下:
1、打开表,如表:use 表1
2、浏览表: brows
3、点击浏览窗口最左边的小方格,点后就变黑了。如图
4、点击主窗口中“表”菜单,选择“彻底删除记录”就行了
if (e.ClickedItem.Text == "删除"){
DialogResult result = MessageBox.Show("您确定要删除所选择记录?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)
if (result == DialogResult.OK)
{
try
{
for (int i = 0i <dataGridView1.Rows.Counti++)
{
if ((bool)dataGridView1.Rows[i].Cells[dataGridView1.Columns["选择"].Index].EditedFormattedValue == true)
{
if ((string)(dataGridView1.Rows[i].Cells[dataGridView1.Columns["审核人"].Index].EditedFormattedValue) == "")
{
string cInvCCode = dataGridView1.Rows[i].Cells[dataGridView1.Columns["分类编码"].Index].Value.ToString()
Update_String = "delete from inventoryclass where cInvCCode='" + cInvCCode + "'"
Update_String1 = "insert into UA_Log(OperatorId,OperatorName,cSituation,ComputerName,IPAddress,MacAddress,dInTime)values('" + FrmMain.Send_Data + "','" + FrmMain.Send_Data_1 + "','删除存货分类[" + cInvCCode + "]成功!','" + FrmLogin.ComputerName + "','" + FrmLogin.IPAddress + "','" + FrmLogin.MACAddress + "','" + DateTime.Now.ToShortDateString() + "')"
SQL_Linker.SQL_Update(Update_String, FrmMain.Send_Data_3)
SQL_Linker.SQL_Update(Update_String1, FrmMain.Send_Data_3)
}
else
{
MessageBox.Show("记录已审核,请弃审后再删除!", "软件提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
return
}
}
}
SQL_Linker.SQL_Bind("select cInvCCode as 分类编码,cInvCName as 分类名称,iInvCGrade as 编码级次,bInvCEnd as 是否末级,cCreatePerson as 建档人,cModifyPerson as 变更人,cVerifier as 审核人 from InventoryClass", FrmMain.Send_Data_3, SDT, dataGridView1)
}
catch { }
}
else
{
return
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)