I have to establish a connection
with files locate on a web server running mysql and php.
What have i to do ? .
Where can i find some samples :
connection,browse,insert modify , delete
Thanks a lot .
Ph Jacquet .
I have to establish a connection
with files locate on a web server running mysql and php.
What have i to do ? .
Where can i find some samples :
connection,browse,insert modify , delete
Thanks a lot .
Ph Jacquet .
oMySql := TMSConnect():New()
oMySql:Connect( cHost, cUser, cPassword )
SELE 1
cTabla:='cores_usuarios'
oTabla1 := TMsTable():New( oDataBase, cTabla )
oTabla1:Open()
SELE 1
REDEFINE LISTBOX oBCli;
FIELDS TRANSFORM(oTabla1:xFieldGet( 1 ),'99999'), ;
oTabla1:xFieldGet( 2 ), ;
oTabla1:xFieldGet( 3 ), ;
oTabla1:xFieldGet( 4 ), ;
TRANSFORM(oTabla1:xFieldGet( 5 ),'9999'), ;
..... etc, etc, as usual
REDEFINE GET oCOD VAR wCOD ID 113 OF oDlg PICTURE "@Z 9999" VALID Q_COD( wCOD,"ALT_USU")
...... all the controls as usual
Then, for inserting:
oSql := TMsQuery():Query( oDatabase, "INSERT INTO cores_usuarios (nomcli,usuario,pass,nro_cliente,nivel_acceso) "+;
"VALUES ('"+wDes+"','"+wUsuario+"','"+wClave+"','"+PADL(wCod,4,'0')+"','"+PADL(wCodnivel,1,'0')+"')")
if !oSql:Open()
oSql:oError:Say()
endif
oSql:Close()
oTabla1:setorder(2)
oTabla1:GoTop():Read()
oBcli:Setfocus()
oBcli:Refresh()
oBcli:Upstable()Thanks for this answer .
Why not using the fiveodbc ?
Ph Jacquet.
jacquet:
You can use odbc if you want, but if you use the mysql api directly it should go faster.
Regards
jacquet,
I use DrMySQL library to connect mysql server.
Sample code below:
METHOD ReBrowse() CLASS TA_Acc_Cust
::oMainDb:Query( "select * from a_cust_code order by name1 limit 100" )
REDEFINE BROWSE ::oBrw ID 301 OF ::oDlg
::oBrw:SetODBF( ::oMainDb )
::oBrw:bKeyDown := {| nKey | ::BrwKeyDown ( nKey ) }
::oBrw:bChange := {|| ::DisplayData() }
::oBrw:lCellStyle := .t.
BrwGrade( ::oBrw )
ADD TO ::oBrw DATA ::oMainDb:CODE ;
TITLE "CODE" ;
SIZE 49
METHOD ReGet() CLASS TA_Acc_Cust
REDEFINE GET ::oMainDb:oNAME VAR ::oMainDb:NAME ID 101 OF ::oDlg
REDEFINE GET ::oMainDb:oCODE VAR ::oMainDb:CODE ID 102 OF ::oDlg
METHOD IsSave() CLASS TA_Acc_Cust
IF ::lNew
::oMainDb:Insert()
ELSE
::oMainDb:Update()
ENDIF
Regards,
Richard
Fivetech.net Taiwan
jac, I use mysql of contrib, with some change made, why mysql.lib is more speed of ado and odbc, and more important you can made change of your need.
regards.
fernando sandoval