Custom Search
Access to Mysql Database In Visual Foxpro

Accessing table in Forms


Form property
height=212
width=450
autocenter=.T.

Drop the following class in the form
5 commandbutton
5 textbox


In the form Init event type the following command:

Public mode, lnhandle
store mode to ''
STORE SQLSTRINGCONNECT('dsn=inventory;uid=inv;pwd=inv') TO lnhandle
IF lnhandle < 0
= MESSAGEBOX('Cannot make connection', 16, 'SQL Connect Error')
retu .F.
ELSE
wait wind 'Remote Connection Succesful'nowait
ENDIF

If SQLExec(lnhandle,"SELECT * FROM product", "product") < 0
= MESSAGEBOX('Product is not accessible', 16, 'SQL Connect Error')
RETURN .F.
ENDIF