Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

Select Command using SQL BETWEEN for DATES

$
0
0

In an attempt to retrieve items between to dates I created the SQLDataSource, listed below. While the query appears to run properly and returns the correct results, what is baffling is the behavior of the code in Visual Studio. The "Select" displays with a warning"unclosed quotation marks", but there are closing quotations; AND, in the line:

 AND FD.[SpecimenType]=@SpecType AND FD.[Result]=@Result ORDER BY Accession">

 FD.[SpecimenType], FD.[Result] and Order By

are in RED Color type, as opposed to the normal blue text...

I tried, but could not get the Between Date syntax to work using  &lt;&gt; but only with  >= AND <  I don't understand why that is? 

 SelectCommand="SELECT 
                                FD.[ContentID] ,
                                FD.[FreezerID] ,
                                FD.[Accession] ,
                                FD.[SampleType] , 
                                FD.[DateInStorage] ,
                                FD.[BarCode] ,
                                 FD.[Media] ,  
                                FD.[Panel] ,  
                                FD.[PatientLName] ,    
                                FD.[PatientFName] ,    
                                FD.[Shelf] ,    
                                FD.[Box] , 
                                FD.[Position],
                                FD.[LocationOther],
                                FD.[Result],
                                FD.[SpecimenType],
                                PROD.[ProdDescription],
                                ST.[SpecimenDecode],
                                RT.[ResultDecode]      
                                FROM [DIS_PHLINVENTORY].[dbo].[FF_FreezerContents] AS FD
                                INNER JOIN ICDbS_Products AS PROD ON FD.FreezerID=PROD.ProductNoID
                                INNER JOIN FF_ddl_SpecimenType AS ST ON FD.SpecimenType=ST.SpecimenID
                                INNER JOIN FF_ddl_Results AS RT ON FD.Result=RT.ResultID
                                WHERE (CAST(DateInStorage AS date)>=@DateFromIn) AND (CAST(DateInStorage AS date)<Dateadd(Day,1,@DateToIn))
                        AND FD.[SpecimenType]=@SpecType AND FD.[Result]=@Result ORDER BY Accession">


Viewing all articles
Browse latest Browse all 3509

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>