Ciao,
ho un problemone..
Dovrei caricare i dati presenti in una tabella Access (mdb) in un database sql.. come fare??
Il database lo gestisco direttamente da codice in vb: tutto ok...
per quanto riguarda la connessione al db MySQL ho creato una connessione con ODBC.. lo stato è = 1.
A questo punto ho fatto un loop che carica i record 1 a 1 e dovrebbe caricarli nel dbMySQL.. posto il codice:
codice:
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
'variabili campi db SQL
Dim PROG As Integer
Dim FORNITORE As String * 30
Dim CONTROLLO As String * 100
Dim NOTE As String * 255
Dim CODICE As String * 20
Dim DESCRIZIONE As String * 255
Dim ENDUSER As Currency
'accesso e risultati
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;PORT=3306;DATABASE=nomedb;USER=User;PASSWORD=pw;OPTION=3;"
conn.Open
MsgBox conn.State
Prodotti.MoveFirst
Do While Prodotti.EOF = False
PROG = Prodotti!PROG
FORNITORE = Prodotti!FORNITORE
CONTROLLO = Prodotti!CONTROLLO
NOTE = Prodotti!NOTE
CODICE = Prodotti!CODICE
DESCRIZIONE = Prodotti!DESCRIZIONE
ENDUSER = ProdottiCH!ENDUSER
conn.Execute ("INSERT INTO Listino (Prog, Fornitore, Controllo, Note, Codice, Descrizione, EndUser) VALUES (PROG, FORNITORE, CONTROLLO, NOTE, CODICE, DESCRIZIONE, ENDUSER)")
ProdottiCH.MoveNext
Loop
MsgBox "SQL Caricato!", vbInformation
Set conn = Nothing
'connessione chiusa
Non mi dà errori ma non carica una mazza!!
H E L P M E P L E A S E ! ! !