我该如何解决这个编译错误?

时间:2012-05-07 10:38:52

标签: c# sqlcommand

我收到此编译错误消息。我该如何解决?

  

错误28'WindowsFormsApplication1.SqlCommand'不包含定义   对于'参数'而没有扩展方法'参数'接受第一个参数   类型'WindowsFormsApplication1.SqlCommand'可以找到(你错过了使用   指令或程序集引用?)C:\ Users \ cofex \ Desktop \ Gestion de salair -   pompier - ARAB - 复制 - 复制\ Gestion de salair - pompier - ARAB - 复制 -   复制\ WindowsFormsApplication1 \ Classes \ employeurclass.cs 152 26       WindowsFormsApplication1

关于此代码:

SqlCommand command = new SqlCommand (query, _connection); // Form1.connection.Open(); 
command.Parameters.AddWithValue("@N_Securite_Social", N_Securite_Social);
command.Parameters.AddWithValue("@N_CCP", N_CCP); 

1 个答案:

答案 0 :(得分:6)

添加

using System.Data;
using System.Data.SqlClient;

命名空间到您的文件