Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySQL and Sage Integrale import problems

Status
Not open for further replies.

chiiiiiz

Technical User
Nov 12, 2007
1
FR
Hi,
For side applications, we import some of our Sage Integrale tables that we then modify into an ACESS 2000 mdb. The access project is reaching now a size of 2 Gb.
What I want to do is import all tables from sage to MySQL, and work from MySQL to be able to make my side applications work.

how shall I import the Sage tables with a SQL instrcution (I use Access and VBA to automate these actions. Now I have the following instruction and the error message "[Sage][Driver ODBC Sage][DRM File Library] No such table or project"

Any help would be most welcome!
Fred
:
Private Sub Form_Load()


'Déclarations
Dim Connexion_AS400 As ADODB.Connection
Dim Recordset_AS400 As ADODB.Recordset
Dim Connexion_MYSQL As New ADODB.Connection
Dim Recordset_MYSQL As New ADODB.Recordset
Dim Code°Client, Requête_SQL1 As String
Dim Nom°Client As String
Dim i As Integer


Dim Adr_IP, Adr_IP_serv As String
Dim Nom_Base As String
Dim Login_Admin As String
Dim Password_Admin As String
Dim option_db As Integer

Adr_IP = "127.0.0.1"
Adr_IP_serv = "localhost"
Nom_Base = "integms"
Login_Admin = "Fred"
Password_Admin = "thev"
option_db = 35


'Connexion à l'AS400
Set Connexion_AS400 = CreateObject("adodb.connection")
Connexion_AS400.Open "DSN=import;UID=Fred;PWD=thev21;DBQ=\soc030;CODEPAGE=1252"

'Connexion à MYSQL
Set Connexion_MYSQL = CreateObject("adodb.connection")
Connexion_MYSQL.Open "DRIVER={MySQL ODBC 3.51 Driver};SERVER=" & Adr_IP & ";DATABASE=" & Nom_Base & ";USER=" & Login_Admin & ";PASSWORD=" & Password_Admin & ";OPTION=" & option_db

Set Recordset_AS400 = CreateObject("ADODB.recordset")
Recordset_AS400.ActiveConnection = Connexion_AS400

Set Recordset_MYSQL = CreateObject("ADODB.recordset")
Recordset_MYSQL.ActiveConnection = Connexion_MYSQL

'Vide la table "articles" de MySQL
Recordset_MYSQL.Open "TRUNCATE TABLE LIGNES_OF1"

Requête_SQL1 = " " & _
" select ENTETE_OF1.NUM_ORD,ENTETE_OF1.LET_RLQ " & _
" from ENTETE_OF1 "

Recordset_AS400.Open Requête_SQL1
Do Until Recordset_AS400.EOF
i = 1
For Each Fld In Recordset_AS400.Fields
Select Case i
Case 1
Code°Client = Fld.Value
Case 2
Nom°Client = Fld.Value
Case Else
End Select
i = i + 1
Next Fld

'Insertion des enregistrements dans la table Clients de MySQL
If Recordset_MYSQL.State = 0 Then
Recordset_MYSQL.Open "articles", Connexion_MYSQL, adOpenKeyset, adLockOptimistic
End If

With Recordset_MYSQL
.AddNew Array("Code_Client", "Nom_Client"), _
Array(Code°Client, Nom°Client)
.Update
End With

Recordset_AS400.MoveNext
Loop
Recordset_AS400.Close
Set Recordset_AS400 = Nothing
Recordset_MYSQL.Close
Set Recordset_MYSQL = Nothing

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top