Back to list
Views:   4.4K
Replies:  1
Archived
Executing CTE from VB.Net From Dynamic Parameter
I am having below mentioned CTE in SQL Server 2012. and want to execute the same in VB.net  ON BUTTON Click event 
Where Start date and End Date Will Come From Datetimepickers ...Please Help on the same

WITH cte as(
 SELECT  [Status], [Date], [Time], CAST([Date] as datetime) + CAST([Time] As datetime) As [datetime] 
  FROM MyTable 
  WHERE [Date] >= @StartDateAND [Date] <= @EndDate) 
    SELECT  [Status], [Date], [Time], 
            CASE WHEN [Date] = LAG([Date]) OVER (ORDER BY [datetime]) THEN 
                 CAST(DATEADD(MINUTE, DATEDIFF(MINUTE, LAG([datetime]) 
                 OVER (ORDER BY [datetime]), [datetime]), '00:00:00') as time)         
                     ELSE  
                  NULL 
            END AS TimeDifferenceFROM cte


 
Lalit Acharekar, Mar 19, 2016
Reply 1
Are you using the SPARK ORM or ADO.NET, Entity Framework, NHibernate, or something else?

We can get you some sample code in SPARK. Any other technology you'll find ample examples on the internet. 
Just let us know. 





Jack Poorte, Apr 04, 2016
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas