I think that I have not explained well (my English is very bad). I have
copied the string of 100 insertions in the window of mysql and has taken 1
minute in inserting the 100 registries, reason why one is not affected by my
speed of connection.
Private Sub Subir_Servidor()
Dim Rec As DAO.Recordset
Dim MyDb As Database
Dim MyQ As QueryDef
Dim Cont As Long
Cont = 0
Set MyDb = CurrentDb()
Set MyQ = MyDb.CreateQueryDef("")
MyQ.Connect =
"ODBC;DATABASE=xxx;DESCRIPTION=xxx;DSN=xxx;OPTION=18699;PWD=xxx;PORT=xxx;SERVER=xxx;UID=calamobel"
MyQ.ReturnsRecords = False
MyQ.sql = " "
Set Rec = CurrentDb.OpenRecordset("Albaranes_lineas_pruebas")
Do While Not Rec.EOF Or Cont < 100 ' limito los registros a subir
If Len(MyQ.sql) > 50000 Then
MyQ.Execute
Cont = 0
Else
MyQ.sql = "INSERT INTO Albaranes " & _
"( IdAlbaran, Tienda, Linea, Referencia, Descripcion, Precio,
Descuento, Cant_Mandada, Cant_Recepcionada, IdColor, IdPedido, Subido,
Bajado, Facturado )" & _
" values ( '" & Rec(0) & "' ,'" & Rec(1) & "' ,'" & Rec(2) & "'
,'" & Rec(3) & "' ,'" & Rec(4) & "' ,'" & Rec(5) & "' ,'" & Rec(6) & "' ,'"
& Rec(7) & "' ,'" & Rec(8) & "' , '" & _
Rec(9) & "' ,'" & Nz(Rec(10), 0) & "' ,'" & CInt(Rec(11)) & "'
,'" & CInt(Rec(12)) & "' ,'" & CInt(Rec(13)) & "' );" & vbCrLf & MyQ.sql
Cont = Cont + 1
End If
Rec.MoveNext
Loop
If Cont > 0 Then
MyQ.Execute
End If
Rec.Close
MyQ.Close
MyDb.Close
End Sub
The resulted string is like this:
INSERT INTO Albaranes ( IdAlbaran, .....) values ( '436' ,.....);
INSERT INTO Albaranes ( IdAlbaran, .....) values ( '436' ,.....);
.......
when sub arrives to MsQ.Execute send an error, but if I copy the string and
after that I paste it to MySql query window, it runs perfectly, but slow
Post by Stefan Hoffmannhi,
Post by JavcalThere is no problem with the long of the string (63000), but I try to
insert 100 records and it late 1 minute, so it isn't fast. Do you have
other idea?
No, because the problem is the speed of your broadband line. As long as
you can't get any faster line, there is not really anything you can do.
If your MySQL runs on a Windows machine with installed Terminal Services
you can run your application local to your MySQL server, but I assume that
is not an option.
mfG
--> stefan <--