PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Copy info from HYPER FILE to MySQL
Copy info from HYPER FILE to MySQL
Iniciado por ale_aragao, 29,ene. 2004 20:10 - 2 respuestas
Publicado el 29,enero 2004 - 20:10
Hi, It´s my first message, I´m begginer.
I´m trying to pass a simple table, with one column to Mysql, but I cant. I don´t know what I´m doing wrong...mybe someone can Help me
mySQL4WD is CMySQL4WD()
n is string
si pas mySQL4WD:mySQLConnecte("localhost", "", "", "Ale") alors
Erreur("Error")
finprogramme()
fin

hinfogene("clientes")
hreadfirst("clientes","nome")

while not h.out
n = clientes.nome //hiper file
mySQL4WD:mySQLExec("insert into nome value("+mySQL4WD:mySQLQuoteString(n)+")",1)
hreadnext("clientes","nome")
mySQL4WD:mySQLFerme(1)
END
mySQL4WD:mySQLDeConnecte()
someone know what´s going on??
thanks to everyone
Publicado el 30,enero 2004 - 00:15
Steps
--------------------------------------------------
1 copy WD70MSQL.dll to c:\windows\system32 //bad habit
2 copy libmySQL.dll to c:\windows\system32
I had a database named "test" and a table named "hello" with a column named "s" in mySql, below is my sample code:
nCnx is int
sReq is string
sReq = "Init"
sSql is string
sUser is string
sPassword is string
sDriver is string
sDataSource is string
sDatabase is string
sDataSource = "localhost"
sUser = ""
sSql = "insert into hello values ('It works') "
sPassword = ""
sDriver = "mySql"
sDatabase = "test"
// "localhost", "", "", "test", "mySql"
nCnx=sqlConnect(sDataSource, sUser, sPassword, sDatabase, sDriver)
SqlExec(sSql, sReq)
SqlClose(sReq)
sqlDisconnect()
Merci
King
Hi, It´s my first message, I´m begginer.
I´m trying to pass a simple table, with one column to Mysql, but I cant. I don´t know what I´m doing wrong...mybe someone can Help me
mySQL4WD is CMySQL4WD()
n is string
si pas mySQL4WD:mySQLConnecte("localhost", "", "", "Ale") alors
Erreur("Error")
finprogramme()
fin

hinfogene("clientes")
hreadfirst("clientes","nome")

while not h.out
n = clientes.nome //hiper file
mySQL4WD:mySQLExec("insert into nome value("+mySQL4WD:mySQLQuoteString(n)+")",1)
hreadnext("clientes","nome")
mySQL4WD:mySQLFerme(1)
END
mySQL4WD:mySQLDeConnecte()
someone know what´s going on??
thanks to everyone
Publicado el 30,enero 2004 - 18:45
Hi Alexandre,
I´m trying to pass a simple table, with one column to Mysql, but I cant. I
don´t know what I´m doing wrong...mybe someone can Help me
mySQL4WD is CMySQL4WD()

I see you try to use the 'alter'-native access (not PCS native access) to
MySQL etc (the '...4WD' projects). Nice. I did not do it exactly your way
but with the interface of the SQLManagerX tools (free !).
--- you need the SQLManagerX project,
available on 'http://sql4wd.rbesset.net/'
(only french, should be translated ;-) ---
First generate a class (database must already be there)
--- code ---
mySQL4WD is c_mySQL4WD()
IF NOT mySQL4WD:mySQLConnecte("127.0.0.1", "login", "pass", "myDatabase") THEN
Error("Error")
EndProgram()
END
objClient is object SQLManagerX(mySQL4WD,"CLIENT","objCLIENT","c_","m_")
objClient:GenereClasse("c:\temp\MyClassClient.txt")
--- / code ---
Import the generated class (copy&paste - name = c_objClient) and
--- code ---
mySQL4WD is c_mySQL4WD()
IF NOT mySQL4WD:mySQLConnecte("127.0.0.1", "login", "pass", "myDatabase") THEN
Error("Error")
EndProgram()
END
cClient is c_objClient(mySQL4WD,"CLIENT","cClient")
cClient:SQLRaz()
HReadFirst(CLIENT,CLIENTID)
WHILE NOT HOut()
cClient:m_ClientID=CLIENT.CLIENTID //?
cClient:m_Name=CLIENT.NAME
// ...
IF NOT cClient:SQLInsert() THEN
Error("not inserted")
END
HReadNext(CLIENT,CLIENTID)
END
--- /code ---
It's working quite nicely. If you just have to do it once the
SQLManagerXConverter can convert your whole HF database to MySQL
in a few steps.
Greetings,
Peter