title: using LIKE command in Stored Procedure
body: <p>I have a stored procedure like this</p>
  
  <pre><code>ALTER PROCEDURE dbo.sp_CheckGlobalizationResourceValue
   (
     @ResourceObject NVARCHAR(255),
     @ResourceName NVARCHAR(128)
      )
  
  AS
  
  select count(*) from vpglobalizationresources
        where ResourceObject = @ResourceObject and 
  ResourceName like '%' + @ResourceName + '%' 
  </code></pre>
  
  <p>And I'm using Linq to SQL classes. I send ResourceObject and ResourceName from .cs file which is shown above. And it's returnValue is always 0 why? Is there something wrong in stored procedure or cs class? I ran this query in database and it works fine there.</p>
  
  <pre><code>public static bool CheckGlobalizationResourceValue(string resourceObject, string resourceName)
      {
          try
          {
              using (var dataContext = new ResourceDBDataContext())
              {
                  resourceObject = resourceObject.Replace(ConfigurationHelper.MainDirectory + "\\", "");
                  resourceObject = resourceObject.Replace("\\", "/");
                  //resourceName = string.Format("'%{0}%'", resourceName);
  
                  var result = dataContext.sp_CheckGlobalizationResourceValue(resourceObject, resourceName);
                  if ((int)result.ReturnValue == 0)
                  {
                      return false;
                  }
                  else
                  {
                      return true;
                  }
                  //return (int)result.ReturnValue != 0;
              }
          }
          catch (Exception exception)
          {
              throw new Exception("An error occured when retrieving data from database");
          }
      }
  </code></pre>