Article ID: 195525
Article Last Modified on 2/14/2005
lnHand = SQLCONN() && Connect to the Visual FoxPro ODBC driver pointing
&& to the testdata.dbc.
string1 = "SELECT cust_id, company, contact, title, address, city,
region, postalcode, country, phone, fax, maxordamt FROM customer WHERE
cust_id = 'ABOUT' AND company = 'Around the Horn' AND contact = 'Thomas
Hardy' AND title = 'Sales Representative'"
string2 = " AND address = '120 Hanover Sq.' AND city = 'London'"
? LEN(string1)
? LEN(string2)
string1 = string1 + string2
? LEN(string1)
y = SQLPREPARE(lnHand, string1)
? y
z = SQLEXEC(lnHand)
?z
=SQLDISCONN(lnHand)
lcdbcname = SYS(2023)+ "\" + SYS(3)
CREATE DATABASE (lcdbcname) && Make new bogus DBC in temp directory.
* Another way to build an easy SELECT statement.
CREATE SQL VIEW testview as ;
SELECT * FROM customer WHERE .T. and .T. and .T. and .T. and .T. and
.T. and .T. and .T. and .T. and .T. and .T. and .T. and .T. and .T. and
.T. and .T. and .T. and .T. and .T. and .T. and .T. and .T. and .T. and
.T. and .T. and .T. and .T. and .T. and .T. and .T. and .T. and .T. and
.T.
* The DBGETPROP statement gets the SQL statement that was just created.
lcSqlText = DBGETPROP('testview', 'view', 'sql')
CLOSE DATABASE ALL
DELETE FILE lcdbcname+'.dbc' && Delete the DBC now that the
&& SQL statement is saved to a
&& variable.
DELETE FILE lcdbcname+'.dct'
lnHand = SQLCONN()
? LEN(lcSqlText)
? SQLPREPARE(lnHand, lcSQLText, 'ctest')
? SQLEXEC(lnHand)
? SQLDISCONN(lnHand)
lnHand = SQLCONN() y = SQLPREPARE(lnHand, mytable.mymemo) ? y z = SQLEXEC(lnhand) ? z ? SQLDISCONN(lnhand)
Keywords: kbsqlprog kbdatabase kbprb KB195525