home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 17,931 of 19,505   
   M Joomun to All   
   Correct syntax please   
   14 Oct 10 13:48:33   
   
   From: m.a.joomun@qmul.ac.uk   
      
   Hello,   
      
   I'm building a Windows Forms App with VB.NET using SQL Server 2008 R2.   
      
   I've got a search form where users can search for records from the db.   
   The App calls a stored procedure which executes the sql below. The form   
   has two search criteria users have requested, 'labno' and 'DateAssayReq'.   
      
   The App works well for the date criteria and will find the correct   
   record(s), but will not return any records whatever I enter for the   
   labno, even though I know the labno exists in the db.   
      
   Can someone see what I've done wrong?   
      
   TIA.   
      
      
      
      
   @labno nvarchar(6) = NULL,   
   @DateAssayReq date   
      
      
   AS   
      
   SELECT assayid, DateAssayReq, LabNo, ReasonRepeat,   
   PersonReq, RepeatedYN, DateRepeated,   
   DtRepeatDy, PersonRepeat, ReasonNotRepeated, LIMSUpdateYN   
      
   FROM tblassay   
      
   WHERE (datalength(@labno) = 0 OR LabNo = @labno)   
   AND (DataLength(@DateAssayReq) = 0 OR DateAssayReq = @DateAssayReq)   
      
      
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca