sqlCommand不包含参数的定义

时间:2019-06-25 06:57:17

标签: c# mysql parameters prepared-statement

  

错误1'vijaystore.DAL.sqlCommand'不包含以下定义   “参数”,无扩展方法“参数”接受第一个   可以找到类型为'vijaystore.DAL.sqlCommand'的参数   缺少using指令或程序集   参考?)E:\ VIJAY \ vijaystore \ vijaystore \ DAL \ userDAL.cs 69 21 vijaystore

try
{
    String sql = "INSERT INTO tbl_user (first_name, last_name, email, username, password, contact, address, gender, user_type, added_date, added_by) VALUES (@first_name, @last_name, @email, @username, @password, @contact, @address, @gender, @user_type, @added_date, @added_by)";
    sqlCommand cmd = new sqlCommand(sql, conn);

    cmd.Parameters.AddwithValue("@first_name", u.first_name);
    cmd.Parameters.AddwithValue("@last_name", u.last_name);
    cmd.Parameters.AddwithValue("@email", u.email);
    cmd.Parameters.AddwithValue("@username", u.username);
    cmd.Parameters.AddwithValue("@password", u.password);
    cmd.Parameters.AddwithValue("@contact", u.contact);
    cmd.Parameters.AddwithValue("@address", u.address);
    cmd.Parameters.AddwithValue("@gender", u.gender);
    cmd.Parameters.AddwithValue("@user_type", u.user_type);
    cmd.Parameters.AddwithValue("@added_date", u.added_date);
    cmd.Parameters.AddwithValue("@added_by", u.added_by);

0 个答案:

没有答案