本文介绍了使用Visual Studio 2010将新记录添加到数据表中。发生错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误3''System.Data.SqlClient.SqlCommand''不包含''close''的定义,并且没有扩展方法''close''接受类型''System.Data.SqlClient的第一个参数。可以找到SqlCommand''(你错过了使用指令或程序集引用吗?)







我很想明白这意味着什么

Error3''System.Data.SqlClient.SqlCommand'' does not contain a definition for ''close'' and no extension method ''close'' accepting a first argument of type ''System.Data.SqlClient.SqlCommand'' could be found (are you missing a using directive or an assembly reference?)



I am failling to understand what this means

推荐答案

con.Close()



应该是


should be

con.Close();





并使用参数化查询来防止SQL注入攻击。



And use parameterized queries to prevent SQL injection attacks.



这篇关于使用Visual Studio 2010将新记录添加到数据表中。发生错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 16:13