userid = " [email protected] "
       string sql = "select * from tabalea  where 电子邮件 = " + userid;
       public static DataTable GetDataSet(string sql)
        {
            SqlDataAdapter sda = new SqlDataAdapter(sql, Connection);
            DataSet ds = new DataSet();
            sda.Fill(ds);
            return ds.Tables[0];
        }    赋值如上描述,调用函数GetDataSet 到   sda.Fill(ds); 出现错误提示 ::"无法绑定由多个部分组成的标识符"请帮助

解决方案 »

  1.   

    string sql = "select * from tabalea  where 电子邮件 = '" + userid + "'"
      

  2.   

    或者:
    string sql = string.Format("select * from tabalea where 电子邮件 = '{0}'", userid);
      

  3.   

    string sql = string.Format("select * from tabalea where 电子邮件 = '{0}'", userid);= '{0}'的这个是什么意思?见笑了
      

  4.   

    使用了格式化,{0}代表userid的值
      

  5.   

    string sql = string.Format("select * from tabalea where 电子邮件 = '{0}'", userid); 如果后面有多个参数怎么写?
      

  6.   

    后面有多个参数时,这样写:string sql= string.Format("{0}{1}",m,n);
      

  7.   

    今天我也遇到了这个问题,加上单引号就没问题了,但这是为什么呢?(我的数据库中的字段是int型的)