Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9222215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:46:49+00:00 2026-06-18T03:46:49+00:00

I have a Program that will auto run each night, run a query, and

  • 0

I have a Program that will auto run each night, run a query, and email results. In my program I am calling a function as part of the query… What i’d like to is pass the date the program is run as the parameter. (@startdate and @enddate) @startdate will always be “today’s” date at 00:00:00 and enddate will always be “Todays date” at 23:59:59. So for example. If the program was run tonight, it would pass 1/31/13 as the date. Tomorrow, it would pass 2/1/13 as the date, the next date 2/2/13, etc. If I can do this at the query level that is fine as well… Below is my code:

SELECT
  SUM(QTY) AS Discounts
FROM
  dbo.fFinancialDataFull('Date Range Report', @startdate , @enddate, '1', '1', 'ALL', 'ALL', 'ALL', 'ALL', '1', '1', '1', '1', '1') AS fFinancialDataFull_1
WHERE
  (ReportCategoryID = 62)) AS unlimitedtbl
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:46:50+00:00Added an answer on June 18, 2026 at 3:46 am

    //These are the date variables.. if u need them seperately

    Dim TodayDt As DateTime = DateTime.Today
    Dim Tomorrow As DateTime = DateTime.Today.AddDays(1)
    Dim TodayEnd as DateTime
    TodayEnd = Tomorrow.AddSeconds(-1)
    

    //This is the SQL Command that executes in SQL Server

      SELECT
      SUM(QTY) AS Discounts
    FROM
      dbo.fFinancialDataFull('Date Range Report', startdate , enddate, '1', '1', 'ALL', 'ALL', 'ALL', 'ALL', '1', '1', '1', '1', '1') AS fFinancialDataFull_1
    WHERE ReportCategoryID = 62
     AND startdate = TodayDt
     AND enddate = TodayEnd AS unlimitedtbl
    

    //This is the function u need to write to make the same SQL run on VB

    Public Function GetValueByDates() As String
        Dim TodayDt As DateTime = DateTime.Today
        Dim Tomorrow As DateTime = DateTime.Today.AddDays(1)
        Dim TodayEnd as DateTime
        TodayEnd = Tomorrow.AddSeconds(-1)
        Dim ReportCategoryID = 62
    
        Dim sql As String = "       SELECT
          SUM(QTY) AS Discounts
        FROM
          dbo.fFinancialDataFull('Date Range Report', startdate , enddate, '1', '1', 'ALL', 'ALL', 'ALL', 'ALL', '1', '1', '1', '1', '1') AS fFinancialDataFull_1
        WHERE ReportCategoryID = @ReportCategoryID
         AND startdate = @TodayDt
         AND enddate = @TodayEnd AS unlimitedtbl"
    
        Using cn As New SqlConnection("Your connection string here"), _
            cmd As New SqlCommand(sql, cn)
    
            cmd.Parameters.Add("@TodayDt", SqlDbTypes.DateTime).Value = TodayDt
            cmd.Parameters.Add("@TodayEnd", SqlDbTypes.DateTime).Value = TodayEnd
            cmd.Parameters.Add("@ReportCategoryID", SqlDbTypes.int).Value = ReportCategoryID 
         Return cmd.ExecuteScalar().ToString()
        End Using
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to have a Singleton that will be auto instantiated on program start.
I have a program that will let me manage users on our terminal server
I have the below program that will move files from one directory to other.
I have a java program that will work with a variety of Java Beans.
I have developed a Java program that will count the number of files in
For a school assignment I have to create a C++ program that will create
In my program, I've got a bunch of classes that will only ever have
So, I have built an auto update program to my program. The code that
I am making a program that auto-runs using windows scheduler. What I'd like to
I have 2 batch programs, 1 is a program that sends email and another

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.