Solved

DBX TSQLQuery results missing fields that are defined to always return null

Posted on 2013-05-10
6
538 Views
Last Modified: 2013-07-22
I have defined a query to return 15 columns.  This is one of several where I have designed the queries to return like data from different tables.  In some tables there is a field for full name.  In others there are fields for First Name, Middle Initial, and Last Name.  I have the routine that uses these fields set to see if the name parts are defined.  If they are not then it reads the Full Name field and breaks out the name.

All of this has been working well.  As I added a new query to the list I found I did not have all of the fields defined.  I added the new fields to the query as:
null FirstName,
null MiddleInitial,
null LastName,

Now when I run the query, all of the fields that will always return null are missing (not in the fields list)!

I am looking for a way to make this TSQLQuery.Open statement return all of the fields.
0
Comment
Question by:developmentguru
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 41

Expert Comment

by:Sharath
ID: 39156642
Post your original and the modifed queries.
0
 
LVL 27

Expert Comment

by:Sinisa Vuk
ID: 39157013
Agree, post it here. My guess goes to this - force type cast for fields like:

cast(null as varchar(100)) as FirstName,
cast(null as varchar(100)) as MiddleInitial,
...
0
 
LVL 21

Author Comment

by:developmentguru
ID: 39163427
The queries are working.  I have one row of data in my result set.  I set an index by name (using the IndexName property) and the one record I have now shows as 0 records.

The data is in a TClientDataset.  You can get data into those without a query, which I am doing here.  I create my dataset independently of several queries, then I add the query results to the client dataset.

using the client dataset I am running into issues.  I have 5 indexes setup from the time I create the dataset (before I add the data).  At one point in the program I run a command like

fCDS.IndexName := 'idxPersonalEmail';

And watch.  Before running that line I have 1 record.  After running it I have 0 records.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 21

Author Comment

by:developmentguru
ID: 39163430
I didn't mention it, but this is being done for a company that is very much against upgrading... it is being done in Delphi 2007.
0
 
LVL 21

Accepted Solution

by:
developmentguru earned 0 total points
ID: 39332939
The routine was using the client dataset within a loop.  I was able to get this working by recreating the client dataset every time I used it.  When the client dataset is recreated each time, before adding the data and setting the index, the setting of the index does not cause the record to disappear.
0
 
LVL 21

Author Closing Comment

by:developmentguru
ID: 39345419
I found a solution to the problem and posted it so others would be able to benefit from it.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
join actual table rows based on the column 25 31
return value in based on value passed 6 39
FMX TEdit KeyUp handler detecting  "enter" key 4 41
error in oracle form 11 28
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question