Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Pass Thru, ADO or Remote Views?
Message
From
27/04/2004 12:20:33
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00898569
Message ID:
00898588
Views:
14
This message has been marked as the solution to the initial question of the thread.
Hi Thomas

>Desired: Create a SQL statement using 6 tables to be used in a more complex report.
>
>
>Tried: SQL Pass through.
>Results: Only able to use one table.
>
>Scenario 1.
>
>Code:
>*Simplified.
>
>Load:
>
>STORE SQLSTRINGCONNECT('Driver={SQL SERVER};Server=N103;Database=Development;uid=User;pwd=User');
> TO tConnection
>IF tConnection < 0
> = MESSAGEBOX('Cannot make connection', 16, 'SQL Connect Error')
>ENDIF
>
>Thisform.pConnection = tConnection
>
>
>Method:
>
>*Simplified.
>*A filter is built called lcFilter
>
>thisform.grdData.recordsource = SPACE(0)
>
>tConnection = Thisform.pConnection
>
>SQLEXEC(tConnection, 'SELECT ReworkNumber, SupplierCode, SupplierName, ;
> PartNumber, PartName, Kanban, Problem, ;
> Model, DateCreated ;
> FROM Tally ;
> &lcFilter ORDER BY ReworkNumber DESC ', 'rvLineCall')
>
>*This works fine. It you precede more than one field name with the *table name it bombs.
>*If you try to use more than one table it bombs.
>*It works great for one table!
>

I use multi-table joins all the time. Your lcFilter would have to reference aliases inside the SQL. Example:

select oa.ord_id, it.itm_id from orders oa inner join items it on itm_ordid = oa.ord_id

If your lcFilter referenced Orders and Items, it would crash.

What does the SQL and lcFilter look like?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform