2014-03-18 89 views

回答

2

只要您安裝了數據提供程序,它應該相對簡單。

I would start by looking at the connection string requirements

有了這一點,你可以通過

cConnectionString = "Driver = blah;Server=blah; etc from connection string website reference"; 
nHandle = SQLStringConnect(cConnectionString) 

if nHandle < 1 
    messagebox("Unable to connect") 
    return 
endif 

*/ Once connected, you can then query the database 
nResult = SQLExec(nHandle, "select * from yourTable", "cursorResultSentBackToVFPSide") 

if nResult < 1 
    messagebox("Error querying data") 
    return 
endif 

*/ If you need to parameterize something, a local variable in your routine can be used 
*/ and will be applied by using the "?" place-holder, such as 

lnSomeIDYouWant = 1234 
lcSQLCmd = "select * from SomeTable where SomeKey = ?lnSomeIDYouWant order by blah" 
nResult = SQLExec(nHandle, lcSQLCmd, "C_VFPAlias") 

SQLDisconnect(nHandle) 

參數得到一個處理數據庫幾乎可以是任何類型的(除了對於像普通/二進制文件,可能需要替代措施,但其他人喜歡邏輯,數字,日期,字符串都沒有問題)。

相關問題