private void button6_Click(object sender, EventArgs e)
{
SqlConnection cnn = new SqlConnection();
cnn.ConnectionString = "Server=192.168.0.4;UID=sa;PWD=JStjsy123;DataBase=ufdata_008_2013";
try
{
cnn.Open();
string Sqlstr = @"update temp set temp = 212 where temp = 22";
SqlCommand myCommand = new SqlCommand(Sqlstr);
myCommand.Connection = cnn;
int i = Convert.ToInt32(myCommand.ExecuteNonQuery());
MessageBox.Show("连接成功消息", "消息标题");
}
catch
{
MessageBox.Show("连接失败消息", "消息标题");
}
finally
{
cnn.Close();
}
}
c# update 数据库始终报连接失败,请指点
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
悬赏问题
- ¥15 不同系统编译兼容问题
- ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?
- ¥30 数字电源对DSP芯片的具体要求
- ¥20 antv g6 折线边如何变为钝角
- ¥30 如何在Matlab或Python中 设置饼图的高度
- ¥15 nginx中的CORS策略应该如何配置
- ¥30 信号与系统实验:采样定理分析
- ¥100 我想找人帮我写Python 的股票分析代码,有意请加mathtao
- ¥20 Vite 打包的 Vue3 组件库,图标无法显示
- ¥15 php 同步电商平台多个店铺增量订单和订单状态