Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Pass Thru, ADO or Remote Views?
Message
De
27/04/2004 12:20:33
Mike Yearwood
Toronto, Ontario, Canada
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00898569
Message ID:
00898588
Vues:
13
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?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform