Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to find the underlying query...

Status
Not open for further replies.

billdvldog

Programmer
Sep 6, 2001
43
0
0
Hello all, I would appreciate any help you gurus can give someone who has never used PowerBuilder before. We have a legacy application built in PB 6.5. One of the windows within the application is showing data that is not in the database, so I am assuming it is somehow using a CASE statement within the query it is using to pull up the data. I need to somehow find out what that query is. I have loaded PB 6.5 on my system, but I can't seem to figure out how to find an underlying query. I tried clicking on the Query button and opened the .pbl file that seemed like it was named for the application window in question, but no queries came up.

I'm sure it's something very simple, but there is no PB documentation left with the software and I'm at a loss as to how to proceed next!

Thanks in advance,

Bill
 
I'm *sorta* new to PB, too... but.. try opening the window, right-click on the datawindow that sits on the window, select "modify datawindow". Then click the 'SQL' button in the toolbar. If it's inherent, you'll see either the SQL statement itself, or a graphic representation. I hate the graphic representation and select "Convert to Syntax" from the "Design" menu to get the actual statement.

If it's not inherent, then the column specifications might open when you click the 'SQL' button. Right-click on a field there and choose 'Stored Procedure'. THis means it's getting data from a stored procedure on the database and should tell you which proc it's using.

If you still can't find it, the SQL could come from code on the window or datawindow. Try looking at the different events on the window and datawindow or just do a search for "SELECT" or something like that. You can do a search on an entire object by highlighting it in the library painter and click the binoculars icon in the toolbar.

Finally, the data could be hardcoded too on the datawindow object itself and not use SQL at all. Click on the object giving bad data, right-click and choose properties. Click on edit tab, scroll to bottom. The bad data might be in a Code Table located there.

There may be other places but can't think of them at this time. Peace.
 
If all else fails try setting up a database trace and capture the statements sent to the db when you open your window in the application.

Matt

"Nature forges everything on the anvil of time
 
How exactly would I set up a db trace? Remember, I've never used PB before :eek:) Thanks! Bill
 
A database trace would be set up in whatever tool you use to administer your database (normally not Powerbuilder). MS SQL Server comes with its own set of tools which I could help you with but I'm not that familiar with other DBs.

Matt

"Nature forges everything on the anvil of time
 
Hmmm, yeah we're using a legacy Sybase ASE database as well. Not sure it even has that capability, but I'll see what I can find out - thanks for the help! Just out of curiosity, how do you do it in SQL Server? We have a number of SQL Servers and it might come in handy!
 
In MS SQL Server 2000 there is a 'Profiler' application you use to set up the trace.

Matt

"Nature forges everything on the anvil of time
 
Roger that, I'll take a look at it. Thanks Matt.

And thanks Eltrigo for your input as well.

I really appreciate it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top