Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Coding with MySQL
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00944377
Message ID:
00944411
Vues:
19
Hi,

I am a new guy in MySQL, i can connect the Database-Table as below:

Con = SQLCONNECT('yourDSNName','yourusername','youruserpass')

I should change all coding in my program,
from open/seek/skip/delete/append/set_order ( .dbf mode )
to MySQL

I haven't any idea in it.
Can you give me some advice to change below program to MySQL ways.

SQLEXEC(Con, 'SELECT * FROM PRODUCTS','RV_PRODUCTS')
**** in .dbf
*Question 1
SELECT RV_PRODUCTS
INDEX ON PRO_CODE TAG P_CODE
INDEX ON PRO_NAME TAG P_NAME
INDEX ON SUBS(PRO_CODE,1,3) + STR(PBARCODE) TAG P_BARCODE
SET ORDER TO P_CODE

Question 2
After i can set the order as 'set order to p_code'
How can i coding as 'skip 1', 'skip -1', EOF, BOF

Question 3
How can i coding as 'Flock', 'Rlock', 'Unlock'
==>For Inserting,
 = SQLSETPROP(Con, 'Transactions', 2)  && Manual transactions
 = SQLEXEC(Con, "INSERT INTO PRODUCTS (FIELD1,FIELD2);
	VALUES (?cFIELD1,?cFIELD2)")
 =SQLCANCEL(Con)
 =SQLCOMMIT(Con)
!!For Updating
= SQLSETPROP(Con, 'Transactions', 2) && Manual transactions
= SQLEXEC(Con, "UPDATE PRODUCTS SET(FIELD1=MEMVAR1,FIELD2=MEMVAR2);
WHERE PRODID=MEMVARPRODID
=SQLCANCEL(lnConnHandle)
=SQLCOMMIT(lnConnHandle)

Question 4
In my old program, i can to brow a .dbf file (it is oepned at begining program) to get my existing records in it.
Do i need to run the "Select * from Product_file" to get existing records every time. If turn, that will make the system slow ???

It depends what situation your in, editing, or product lookup, if product lookup you can copy to a local table then close the connection from the remote data..

SQLEXEC(Con, 'SELECT * FROM PRODUCTS','RV_PRODUCTS')
**** in .dbf
*Question 1
SELECT RV_PRODUCTS
COPY TO DATA\PRODUCTS && TMPPRODUCTS
Jojo R. dela Cuesta, B.Sc.
eConsultant, Programmer
Dalplus Technologies
http://www.dalplus.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform