private void tsmiSH_Click(object sender, EventArgs e)
{
int m = dataGridView1.CurrentRow.Index;
String name = dataGridView1.Rows[m].Cells[0].Value.ToString();
DialogResult cc = MessageBox.Show("确定要通过" + name + "的审核吗?", "信息提示", MessageBoxButtons.YesNo);
if (cc == DialogResult.Yes)
{
SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=User;Integrated Security=True;MultipleActiveResultSet s=true");
conn.Open();
String sql = "updata total set login = 'yes' ";
SqlCommand Command = new SqlCommand(sql, conn);
Command.ExecuteNonQuery();
int z = Command.ExecuteNonQuery();
if (z > 0)
{
MessageBox.Show("审核失败!");
}
else
{
MessageBox.Show("审核成功!");
Formshenhe frm = new Formshenhe();
frm.Show();
this.Hide();
}
}
}
运行后一直显示报错 这是为什么
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- qq_1306620048 2021-10-19 11:22关注
String sql = "updata total set login = 'yes' "; 你这对吗? 你把sql拿出去去数据库里执行 你看对吗? 不应该是update 希望对你有所帮助
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用
悬赏问题
- ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
- ¥15 cmd cl 0x000007b
- ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
- ¥500 火焰左右视图、视差(基于双目相机)
- ¥100 set_link_state
- ¥15 虚幻5 UE美术毛发渲染
- ¥15 CVRP 图论 物流运输优化
- ¥15 Tableau online 嵌入ppt失败
- ¥100 支付宝网页转账系统不识别账号
- ¥15 基于单片机的靶位控制系统