DialogResult result = MessageBox.Show("确定删除该条数据吗?", "消息提示", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
if (result != DialogResult.Yes)
{
return;
}
int name = Convert.ToInt32(this.jk.SelectedRows[0].Cells["jiage"].Value);
string sql = string.Format(@"DELETE [dbo].[MobileInfo] WHERE Price = {0}",name);
SqlConnection conn = new SqlConnection(DBHelpercs.CONNECTION_STRING);
conn.Open();
SqlCommand comm = new SqlCommand(sql, conn);
int count = comm.ExecuteNonQuery();
if (count > 0)
{
MessageBox.Show("删除成功", "消息提示");
}
else
{
MessageBox.Show("删除失败", "消息提示");
}