Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Ken Murphy
  Where is Ken Murphy?
 Springhill
 Canada
 Ken Murphy
 To: Susan Allen
  Where is Susan Allen?
 cleveland
 Ohio - United States
 Susan Allen
Subject: RE: Converting Reports to SQL
Thread ID: 116521 Message ID: 116529 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: ODBC, ADO and OLEDB
Date: Monday, December 18, 2006 8:14:14 PM         
   



> Hi, all; I am converting a VFP report to a MSSQL backend. The VFP report has the .dbf graphically embedded in the Data Environment. I deleted that, put my SQLEXEC statements in the Init method. In that method, I get the correct number of records in the recordset (named "Customers"). However, when I "SELECT CUSTOMERS" I get the error "Alias 'CUSTOMERS' is not found." I am using a Private Data Session. Am I missing something?

Susan,

If you are using a MySQL backend, you have three choices:

1 - Use SQL Pass Through (SPT). I take it that you already have a connection. You can use that connection in your report as well. Delete your tables from the report's DE and in the DE's .OpenTables method, add your SQLEXEC statements. I typically use this concept with my apps (done with a SQL backend) and create a "Report Cursor." Rather than build a series of cursors to exactly replicate the report's DE, I create a single flatfile (non-normalized) cursor for my report. (I am not saving the data in the cursor to disk so I don't care if the data is normalized.) Now I have one cursor containing all of the fields and records that I need for my report, and only the fields and records I need for my report.

2 - Use a parameterized CA. You can drop a CA onto a report's DE just as you would a form's DE.

3 - Use a parameterized remote view. Again, you can drop a view on the report's DE as well.

I suspect that you are trying to duplicate the table concept in your report and this is what is giving you grief. The error message however is probably due to a group by or print when option that is still looking for the old tables rather than your SPT cursors. With a flat file report cursor, you just preface everything with your report cursor's alias.

Ken
You shall know the truth - and the truth shall set you free. (John 8:33)

ENTIRE THREAD

Converting Reports to SQL Posted by Susan Allen @ 12/18/2006 7:10:39 PM
RE: Converting Reports to SQL Posted by Ken Murphy @ 12/18/2006 8:14:14 PM
RE: Converting Reports to SQL Posted by tushar @ 12/18/2006 8:20:10 PM
RE: Converting Reports to SQL Posted by Susan Allen @ 12/18/2006 9:01:23 PM
RE: Converting Reports to SQL Posted by Ken Murphy @ 12/18/2006 9:06:41 PM
RE: Converting Reports to SQL Posted by Susan Allen @ 12/18/2006 9:18:53 PM
RE: Converting Reports to SQL Posted by Ken Murphy @ 12/18/2006 9:46:18 PM
RE: Converting Reports to SQL Posted by Susan Allen @ 12/18/2006 10:49:50 PM
RE: Converting Reports to SQL Posted by Barbara Peisch @ 12/19/2006 8:09:55 PM
RE: Converting Reports to SQL Posted by Andy Kramek @ 12/18/2006 11:59:25 PM