Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to use SQL OpenRowSet thru VFP9
Message
De
18/11/2006 09:45:57
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01170941
Message ID:
01170966
Vues:
12
>Hi !!
>
>I would like to use my free tables in the SQL for fetching the details with the help of SQL command - OPENROWSET(). The problem is, this command is working thru the SQL Query Analyzer but not working thru VFP. Pls guide me, how can I execute the same thru VFP ?
>
>Thanks in advance
>Ravi Mehrotra
lnHandle=SQLStringConnect('DRIVER=SQL Server;SERVER=(local);Trusted_connection=Yes')
lcDataSource =  _samples + 'data\testdata.dbc'

Text to m.lcSQL textmerge noshow
SELECT customers.* 
  FROM 
  -- this is MSSQLs own table customers aliased as customers here
  Northwind.dbo.customers customers
  inner join 
  -- this is VFP's testdata!customer aliased as vfpCustomer
  -- we are gonna join with it.
  -- notice that it's used as if it was a native MSSQL table 
  -- also notice that since we are calling this from MSSQL
  -- ANSI SQL is in effect. (IOW ANSI is ON)
  -- therefore we cannot simply say cust_id = 'F'
   OPENROWSET('VFPOLEDB', 
       '<<m.lcDataSource>>';'';'',
       'select * from customer where cust_id like "F%"') vfpCustomer
  On customers.customerID = vfpCustomer.cust_id
EndText

SQLExec(m.lnHandle, m.lcSQL,'myVFPData')
SQLDisconnect(m.lnHandle)

* Check results
Select myVFPData
Browse
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform