Hi guys, Im newbee about the programming , I have an issue but couldnt fix anyway. Please help me
here is my code to read mdb file and it works fine
and here is my code for insert something to mysql end it works fine
I want to work with together which first scripts reads the datas row by row and write to mysql second script.
Can someone help me?
here is my code to read mdb file and it works fine
Code:
' Connection String required to connect to MS Access database
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;"
' SQL statement to run
sql = "select * from tuser"
' Create ADO Connection/Command objects
set cn = createobject("ADODB.Connection")
set cmd = createobject("ADODB.Command")
' Open connection
cn.open connectionString
' Associate connection object with command object
cmd.ActiveConnection = cn
' Set the SQL statement of the command object
cmd.CommandText = sql
' Execute query
set rs = cmd.execute
' Enumerate each row in the result set
while rs.EOF <> true and rs.BOF <> True
' Using ordinal
wscript.echo "ID Numarası: " & rs(0) & " Adı Soyadı: " & rs("name") & " Kart Numarası: " & rs("cardnum")
rs.movenext
wend
' Close Connection
cn.Close
Code:
Dim baglan
Dim baglanti
Set baglanti = CreateObject("ADODB.Connection")
baglan = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=192.168.2.2; PORT=3306;" &_
"DATABASE=test; USER=root; PASSWORD=; OPTION=3;"
baglanti.Open baglan
Dim sorgu
sorgu = "INSERT INTO kayitlar (saat, tarih) VALUES (67867876, 8678678768)"
baglanti.Execute sorgu
baglanti.Close
Can someone help me?