ExecuteNonQuery: Connection 属性尚未初始化
2013-12-07 20:12
330 查看
http://zyzyhao336.blog.163.com/blog/static/263007452008915113450359/
敲代码的时候,发现这个错误,当时百度看了上面的地址,明白自己的代码:
SqlConnection con = new SqlConnection(connstr3);
con.Open();
SqlCommand cmd = new SqlCommand(sql增删改查执行语句, con);
cmd.ExecuteNonQuery();
忘记把con添加上去了,只要在SqlCommand方法内添加需要执行的sq语句和sql连接字符就可以了。
敲代码的时候,发现这个错误,当时百度看了上面的地址,明白自己的代码:
SqlConnection con = new SqlConnection(connstr3);
con.Open();
SqlCommand cmd = new SqlCommand(sql增删改查执行语句, con);
cmd.ExecuteNonQuery();
忘记把con添加上去了,只要在SqlCommand方法内添加需要执行的sq语句和sql连接字符就可以了。
相关文章推荐
- Iphone开发用导航控制器实现视图的分层切换(UINavigationController)
- Core Image Programming Guide
- Core Image Programming Guide--图像编程指南
- 如何使EnableMenuItem函数的调用有效
- easyui不规范同步树数据构建同步树
- new (addr)type(value)
- The Collatz Sequence
- ios开发-屏幕截图(UIView转为图像存储到本地)
- 极客疯人院UI设计
- ucgui 嵌入式 输入法 包含拼音、笔画、英文、数字与符号的完整输入法软件
- System.Web.UI.WebControls
- Android UI设计指南
- duilib速记
- GUI易用性测试
- UIScreen
- 【翻译】Google TV UI 设计模式 (引子)
- jlink烧写Nor Flash时出错正确解决方法汇总:PC of target system has unexpected value after programming
- jlink烧写Nor Flash时出错正确解决方法汇总:PC of target system has unexpected value after programming
- jlink烧写Nor Flash时出错正确解决方法汇总:PC of target system has unexpected value after programming
- 关于“The value for the useBean class attribute … is invalid”错误的解决