cmm.Parameters.Add(new SqlParameter(..))看看。

解决方案 »

  1.   

    不明白你这,我会两种
    1:sqlcommand command = new sqlcommand(存储过程名,连接);
    2:sqlcommand command = new sqlcommand(执行的sql语句,连接);
    //sql是字符串,参数用string sql = string.Format("select top 1 Id from tbBusiness where Id like {0}  order by Id DESC ",FontPart);
    你这是调用存储过程时设置参数
                  comm.Parameters.Add("@InsertDate",SqlDbType.NVarChar,12); 
                comm.Parameters["@InsertDate"].Value = FontPart; 
      

  2.   

    string strText="select top 1 Id from tbBusiness where Id like '%'+@InsertDate+'%'  order by Id DESC"
    comm.Parameters.Add("@InsertDate",SqlDbType.NVarChar,12).Value=FontPart; 
      

  3.   

    string strText=@"select top 1 Id from tbBusiness where Id like '%"+@InsertDate+"%'  order by Id DESC" ;