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 9271491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:37:42+00:00 2026-06-18T15:37:42+00:00

How would I retrieve the data from the ‘DAILY_CALCULATIONS’ table Dim SqlQuery As String

  • 0

How would I retrieve the data from the ‘DAILY_CALCULATIONS’ table

  Dim SqlQuery As String = "SELECT WEEKLY_TIMECARD.*,DAILY_CALCULATIONS.*,EMPLOYEE_PROFILES.EMPLOYEE_NUMBER "
    SqlQuery = SqlQuery + " FROM WEEKLY_TIMECARD, DAILY_CALCULATIONS, employee_profiles WHERE employee_profiles.employee_number"
    SqlQuery = SqlQuery + " = WEEKLY_TIMECARD.employee_number AND EMPLOYEE_PROFILES.EMPLOYEE_NUMBER = DAILY_CALCULATIONS.EMPLOYEE_NUMBER AND"
    SqlQuery = SqlQuery + " WEEKLY_TIMECARD.WEEK_NUMBER = DAILY_CALCULATIONS.WEEK_NUMBER AND WEEKLY_TIMECARD.EMPLOYEE_NUMBER ="
    SqlQuery = SqlQuery + "'" + txtENumber.Text + "' AND WEEKLY_TIMECARD.WEEK_NUMBER = '" + CBWeekNum.SelectedItem + "'"

    Try

        con.Open()

        If con.State = ConnectionState.Open Then
            con.ChangeDatabase("shopclocksoftware")
            Command = New MySqlCommand(SqlQuery, con)
            Data = Command.ExecuteReader()

            While Data.Read
                txtHUnits.Text = Data(2).ToString
                txtOUnits.Text = Data(3).ToString
            End While

I had a look at the Data.NextResult method, but I wasn’t able to implement it properly, Any ideas?

  • 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-18T15:37:43+00:00Added an answer on June 18, 2026 at 3:37 pm
    Dim SqlQuery As String = "SELECT wtc.A, wtc.B, wtc.C, dc.D, dc.E, ep.F, ep.G"
    SqlQuery = SqlQuery + " FROM WEEKLY_TIMECARD wtc, DAILY_CALCULATIONS dc, employee_profiles ep "
    SqlQuery = SqlQuery + " WHERE ep.employee_number"
    SqlQuery = SqlQuery + " = wtc.employee_number AND ep.EMPLOYEE_NUMBER = dc.EMPLOYEE_NUMBER AND"
    SqlQuery = SqlQuery + " wtc.WEEK_NUMBER = dc.WEEK_NUMBER AND wtc.EMPLOYEE_NUMBER ="
    SqlQuery = SqlQuery + "@ENumber AND wtc.WEEK_NUMBER = @CBWeekNum"
    
    Try
        con.Open()
    
        If con.State = ConnectionState.Open Then
            con.ChangeDatabase("shopclocksoftware")
            Command = New MySqlCommand(SqlQuery, con)
            Command.Parameters.AddWithValue("@ENumber", txtENumber.Text);
            Command.Parameters.AddWithValue("@CBWeekNum", CBWeekNum.SelectedItem);
    
            Data = Command.ExecuteReader()
    
            Dim aOrdinal As Integer = reader.GetOrdinal("a")
            Dim bOrdinal As Integer = reader.GetOrdinal("b")
    
            While Data.Read
                txtHUnits.Text = Data.GetString(aOrdinal)
                txtOUnits.Text = Data.GetString(bOrdinal)
            End While
    ....
    Exit Try
    

    A few things to note:

    1. I changed your SQL to use aliases, and to return explicit field names. using * is generally a bad idea, especially if you only actually need a subset of columns.
    2. The query is now parameterized, so you aren’t open to SQL injection attacks
    3. I make use of GetOrdinal to locate the position of any column in the result set. This is a minor optimisation.
    4. Call GetString if the column you are returning is a string. Otherwise you can call as previously.

    Obviously I don’t now your column names so the SQL won’t work but you should get the idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I retrieve data from a SQL data frame in R using: query <- SELECT
I'm building a database and i would like to retrieve specific data from objects
I would like to retrieve some data from a Mongoose setting in my Node.js
I would like to retrieve some data from a couple of different websites(that is
I have a situation where I would like to retrieve data from the session
I am using VS2005 C# and SQL2005. I would like to retrieve data from
I would like to retrieve data from a database which is of type varchar
I am a newbie and I would like to store and retrieve data from
I would like to be able to retrieve the data-type , which is a
I am adding data to my database, but would like to retrieve the UnitID

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.