cnn=SQLCONNECT(\ SQLEXEC(cnn,\orderid,productid,unitprice,quantity,discount details]\SELECT mycursor
CURSORSETPROP(\
CURSORSETPROP(\
CURSORSETPROP(\CURSORSETPROP(\
[order
details].orderid,unitprice
[order
details].unitprice,quantity [order details].quantity,discount [order details].discount\CURSORSETPROP(\
һOrder Details
ע⡰TablesԵдSQL Serverִոı÷ںŷָTablesָԴԱã[order details]롣
ע⡰KeyFieldListԵдorder detailsؼһϹؼ֣orderidproductidɣҪһ롣
һҪԡWhereType
趨Ϊɸ¹һҪû趨WhereTypeWhere־ݣ
CURSORSETPROP(\ݹؼ
CURSORSETPROP(\ݹؼ֣ɸֶ CURSORSETPROP(\ݹؼ+Ѹֶ CURSORSETPROP(\ݹؼ֣ʱ
ϸݴҿԲοԶͼ½ڣѾúܶˡ
from [order
ġvfpsql serverClient/ServerӦó(Զͼ)(1)
-
ǡ Visual FoxPro SQL Server Client/Server Ӧóϵеһ֣ԶͼӦǿƪ½ڣǷ:Ϊվ̫ԵĶΪ˻һìܣǾѡԶͼд
е ADO ̥ Visual FoxProʵʹ߸ɫԲҪС Visual FoxPro Զݴϵǿ߿ԲοվġMicrosoft Visual FoxPro Ա ADO š롶Visual FoxPro ̸
ϣͨصʽɡ Visual FoxPro SQL Server Client/Server ӦóһģdzϣõĽ顣
˵ǰ
ڱ֮ڸϳģ˼ܣѡ SQL Server ݿʱһNorthwind ݿоֶַΣУʹ nVarchar ͣVisual FoxPro Դֵ֧IJãԭվϿʾԴǿ SQL Server Enterprise Manager айֶεĵʹ nVarchar Ϊ Varcharҽ Customers е CustomerID Phoneֶεͱ仯ɡͬģǿ Employees Notes ֶͱΪ text
ҵĴ
Visual FoxPro ͼȻෳ˵ԶͼIJرӵԶͼֺܻ֧ܲĶʵʱ벻ҪߡVisual FoxPro ԶͼĹܷdzǿģ߳ͼܺܺõ֧֣
ǰ
Visual FoxPro Ϊ Client/Server ܵӦṩõĽԶͼ(Remote Views) SPT(SQL pass through)ȻVisual FoxProǿʹԶӵķ ADOЩӣԶͼĺôԷdzVisual FoxProÿؼÿһԶͼһ洢Visual FoxProݿDBCĶһSQL-SELECT䡣ԶͼͨODBCOpen Database Connectivity)칹ݿͨѶ
ȻĵʵʹSQL Server Ϊݿ⣬ͬʹԴΪݿ⣬ OracleIBM DB2Informix,Sybase,Microsoft Access,Excel,Visual FoxProԼʹԶͼԶݾVisual FoxProһ㣬ǽһΰߵijӦá
-Connections
ʹԶͼԶݵĵһǽԶԴͨѶкüַɹѡעЩʹ ODBC Զӡ
һdzԶͼǣȡ Northwind ݿ Customers ļ¼Զͼ Vcustomers С
CREATE SQL VIEW Vcustomers ; REMOTE CONNECTION Northwind ; AS SELECT * From Customers
*ȱ䣬Ϊӻûн
ĵڶǸVisual FoxProʹ Northwind SQL Server ͨѶʱVisual FoxProطѰӣ
ǰ ݿDBCв鿴Ƿݿ⡰ӶNorthwind֮߳Ϊ DSN Ӷ
ûз֣Visual FoxProڿͻ OCBC Data Source Names(DSNs)в鿴Ƿ Northwind֮߳Ϊ DSN ӡ
DSNs
ӵ졢ķǽDSNsڿд ODBC ͼ1
ͼ 1. ODBC Data Source Administrator
ǷDSN :
ûDSNϵͳDSNļDSNûֻԽûЧƩ Administrator ݵ¼ϵͳһûDSNô Administrator ¼ϵͳ㲻ʹһDSNϵͳԵǰûûЧʲôݵ¼ϵͳļDSNʵһDSNΪıļ Visual FoxPro ĽǶȣ߰ DSN ֳࣺ
û͡ϵͳ DSNԵΪΪԶͼʹãҲΪ DSN ӶĻ DSN Ӷûͻϵͳ DSN
ļ DSNԵΪΪԶͼʹãΪơַӶṩϣַӶļ DSN
Ƚһϵͳ DSN
ODBC Data Source Administrator ѡ System DSNҳAddѡ SQL Server ɡťͼ2
ͼ 2. 趨 DSN Ƽ
ѡlocal)עϵͳĿӽ˳Ļͼ3Ļ棬Ҫѡû֤ʽѡ SQL Server Windows ֤ʽ¼SQL ServerûsaΪա
ͼ 3. 趨 DSN ĵ¼Ϣ
˳4ĻϣһѡҪرע⣬ѡĿݿ⡣ǵȻѡNorthwind
ͼ 4. 趨 DSN ĵ¼ݿ
ϻͲ˵ˣһЩ˳СNorthwindSystem DSN ͽˡ
Visual FoxProн䣺
CREATE DATABASE Northwind
*ݿ洢ݿ CREATE SQL VIEW VCustomers ;
REMOTE CONNECTION Northwind ; AS SELECT * FROM Customers
*Զͼעͼݿ⣨DBCһԱȽDBC USE VCustomers *Զͼ BROWSE
*Զͼ
ݿDBCеġӶ
ǵǰǽӿԴط DSNsDBCôDSNDSNӶʲô
DSNӶΪԶͼDSNӲԡ֪ÿһSQL ServerӶҪշѵģӾͿʡǮǻ֪SQL ServerÿӴԼҪȥ24Kڴռ䣬˽24K࣬SQL ServerǷֻһʹһӡһӡϵͳЧһӰ졣۴ӿɱϵͳЧʵĽǶȣӶǿԱȻѡ
Ϊ˵ʲôǹӣΪ֤DSNӲΪͼ飺
CREATE SQL VIEW VOrders ;
REMOTE CONNECTION Northwind SHARE;