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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:43:08+00:00 2026-05-10T20:43:08+00:00

I am having a problem getting a list of fields from a query defined

  • 0

I am having a problem getting a list of fields from a query defined at run time by the users of my program. I let my users enter a SQL query into a memo control and then I want to let them go through the fields that will return and do such things as format the output, sum column values and so forth. So, I have to get the column names so they have a place to enter the additional information.

I would do fine if there were no parameters, but I also have to let them define filter parameters for the query. So, if I want to set the parameters to null, I have to know what the parameter’s datatype is.

I am using Delphi 2006. I connect to a Firebird 2.1 database using the DBExpress component TSQLConnection and TSQLQuery. Previously, I was successful using:

for i := 0 to Qry.Params.Count – 1 do Qry.Params[i].value := varNull;

I discovered I had a problem when I tried to use a date parameter. It was just a coincidence that all my parameters up until then had been integers (record IDs). It turns out that varNull is just an enumerated constant with a value of 1 so I was getting acceptable results (no records) was working okay.

I only need a list of the fields. Maybe I should just parse the SELECT clause of the SQL statement. I thought setting Qry.Prepared to True would get me a list of the fields but no such luck. It wants values for the parameters.

If you have an idea, I would sure like to hear it. Thanks for any help.

  • 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. 2026-05-10T20:43:08+00:00Added an answer on May 10, 2026 at 8:43 pm

    Replied again ‘coz I’m interested. My methods works (with my queries) because they have been pre-defined with the params’ datatypes preset to the correct type:)

    I’m not sure how you are expecting the query to know or derive the datatype of the param given that you are not even selecting the field that it operates against.

    So I think your query setup and user input method will need more attention. I’ve just looked up how I did this a while ago. I do not use a parameterised query – I just get the ‘parameter values’ from the user and put them directly into the SQL. So your sql would then read:

    SELECT s.hEmployee, e.sLastName
    FROM PR_Paystub s
    INNER JOIN PR_Employee e ON e.hKey = s.hEmployee
    WHERE s.dtPaydate > ’01/01/2008′

    therefore no parameter type knowledge is necessary. Does not stop your users entering garbage but that goes back to input control 🙂

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

Sidebar

Ask A Question

Stats

  • Questions 299k
  • Answers 299k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You are almost there. Assuming you have the data frame… May 13, 2026 at 7:51 pm
  • Editorial Team
    Editorial Team added an answer With Mercurial, you keep your repositories generally inside the working… May 13, 2026 at 7:51 pm
  • Editorial Team
    Editorial Team added an answer do the call once: setTimeout("doGoogleMapApiCall()", 5000); .. or multiple times:… May 13, 2026 at 7:51 pm

Related Questions

I am trying to use JAXB's introspection to marshall and unmashall some existing domain
I have a VB6 application which works with datetime values in SQL Server (which
I have the following object: [Serializable] public class ExampleImage { public int ID {
I am struggling with a nullable datetime column [DateInsp] in an ASP.NET app which

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.