Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27189

Translating DateAdd Access Function into ADO.NET

$
0
0
I have queries in an access database that I would like to move to ADO.NET. I am trying to figure out what I need to do in order to translate the query below into a format usable by ADO.NET. I tried using the designer but it seems limited for anything other than simple sum and calculations.

Below is the code from my access database:
Code:

SELECT tblWorkQueue.AccountNumber, tblWorkQueue.RenewalDate, DateAdd("d",-90,[RenewalDate]) AS FirstLetterBegin, DateAdd("d",-45,[RenewalDate]) AS FirstLetterDue, tblWorkQueue.FirstLetterStatus, tblWorkQueue.RenewalType
FROM tblWorkQueue
WHERE (((DateAdd("d",-90,[RenewalDate]))<=Date()) AND ((DateAdd("d",-45,[RenewalDate]))>Date()) AND ((tblWorkQueue.FirstLetterStatus)="Incomplete"));

I am not entirely clear on T-SQL as far as VS2010 Designer is concerned, as it appears some functions exist but others do not (I guess you cannot have a user-defined function). Am I doing things the hard way? I have controls bound to a datatable, and a combobox. The combobox selected item should pick a query: 1, 2, 3, and load the data into a table returned from the selected query which subsequently loads items into the controls and binding navigator. The data being returned is dependent on account renewal dates and the above example would be "query1". How should i be handling my dateadd functions?

Viewing all articles
Browse latest Browse all 27189

Trending Articles



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