public DataTable SearchProduct(string Region,string ProductName, string Manufacturer)
        {
            string strSql = string.Empty;
            strSql = "SELECT " +
                        "Guid ," +
                        "ProductNumber ," +
                        "ProductName ," +
                        "ProductStyle ," +
                        "ProductOrigin ," +
                        "PackUnit ," +
                        "ReferencePrice ," +
当Region = NUll时候要求ReferencePrice 列的值都为*   该怎么修改?

解决方案 »

  1.   

     "ReferencePrice ," +
    ------> "ReferencePrice = case when Region is null then '*' else ReferencePrice end ," +
      

  2.   

     SearchProduct(string Region,string ProductName, string Manufacturer)
    是Region参数
      

  3.   

    ...string strSql = string.Empty;
      strSql = "SELECT " +
      "Guid ," +
      "ProductNumber ," +
      "ProductName ," +
      "ProductStyle ," +
      "ProductOrigin ," +
      "PackUnit ," 
      if Region = string.Empty
         strSql =  strSql +
      "ReferencePrice ='*'," 
      else
         strSql =  strSql +
      "ReferencePrice ,"   strSql =  strSql + ...