Information générale
Catégorie:
Codage, syntaxe et commandes
Hello everybody !!
I'm experimenting with Foxpro and a My_SQL Database (Windows) !
The server is up and running ! I can connect ! I can read data into Foxpro cursors !
But i have problems with update and insert ??
The following example code is working.
local l_verbindungsnr
*open the connection
do p_open in p_funktionen with l_verbindungsnr
if l_verbindungsnr >= 0
l_fehler = SQLPREPARE(l_verbindungsnr,'INSERT into t_adressen SET adressnr = "47111",name1="Tester"')
l_fehler1= SQLEXEC(l_verbindungsnr)
messagebox(str(l_fehler) + " " + str(l_fehler1))
endif
*******************
Now i want the insert data from a local cursor or table
fieldtypes in mysql are char(6) and char(30)
fieldtypes in t_data are c(6) and c(30)
local l_verbindungsnr
use t_data
set order to
seek(...)
if found()
l_adressnr = t_data.adressnr
l_name1 = t_data.name1
endif
*open the connection
do p_open in p_funktionen with l_verbindungsnr
if l_verbindungsnr >= 0
l_fehler = SQLPREPARE(l_verbindungsnr,'INSERT into t_adressen SET adressnr = l_adressnr,name1=l_tester')
l_fehler1= SQLEXEC(l_verbindungsnr)
messagebox(str(l_fehler) + " " + str(l_fehler1))
endif
This brings up -1 for the sqlprepare and -1 for the sqlexec !
i tried this:
l_fehler = SQLPREPARE(l_verbindungsnr,'INSERT into t_adressen SET adressnr = @l_adressnr,name1=@l_tester')
l_fehler1= SQLEXEC(l_verbindungsnr)
messagebox(str(l_fehler) + " " + str(l_fehler1))
This brings up 1 for the sqlprepare and -1 for the sqlexec !
Same problem with update !! Direct values work fine !! No success with variables !! The messagebox brings up 1 and 1 , but no update is done (record not found)
What I'm doing wrong ???? Do i have to convert the fields from the table or cursor ??
Any help welcomed.
Best regards
Albert
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement