Merci Jordane pour ta réponse .. j'ai mis une image du code .. je sais pas si tu n'arrives pas à la voir!
Voici tout le code:
''' <summary>
''' Example for exporting Excel data to an ENTERPRISE Synthesis Data Warehouse (SDW)
''' </summary>
''' <remarks>YOU MUST HAVE THE SAME bit-VERSION of Synthesis and Excel for this to work!
''' If you are using the 64-Bit office you need the 64-Bit Version of Synthesis
''' This code applies to enterprise repositories. (Not standard repositories)
''' </remarks>
''' <summary>
''' Provides the command button with a process
''' </summary>
''' <remarks>Provides a process for opening a specific repository</remarks>
Private Sub ProcessRDW_Click()
'Dimension the RawDataSet variable
Dim RDSet As New RawDataSet
'Set a Name for the Extracted data set
Dim DName As String
DName = InputBox("Data set name?")
If DName = "" Then
MsgBox "Operation Canceled/Aborted"
Exit Sub
End If
RDSet.ExtractedName = DName
'This is Weibull data
RDSet.ExtractedType = RawDataSetType_Weibull
'Load Excel data from the spreadsheet into the RawDataSet
Call PopulateDataSet(RDSet)
'Declare a new repository connection class
Dim MyRepository As New Repository
frmWait.lblWait = "Connecting to Repository..."
DoEvents
'Modify variables below to connect to your enterprise database.
Dim ServerName As String
Dim DataBaseName As String
ServerName = "CNFR009087\SQLEXPRESS"
DataBaseName = "AlstomFiabilité"
'Connect to the Synthesis repository
Dim Success As Boolean
Success = MyRepository.ConnectToSQLRepository(ServerName, DataBaseName)
If Not Success Then MsgBox "Unable to connect the Database - " & ServerName & "/" & DataBaseName
'Save the raw data to the Synthesis repository
Success = MyRepository.DataWarehouse.SaveRawDataSet(RDSet)
If Success Then
frmWait.lblWait = "Sucess!"
MsgBox "The data have been saved."
DoEvents
Else
MsgBox "Unable to save data"
End If
'Disconnect the Synthesis repository
Call MyRepository.DisconnectFromRepository
Unload frmWait
End Sub
''' <summary>
''' Start loading Excel data into the RawDataSet object that will load into the repository
''' </summary>
''' <remarks>Helper Subroutine for ProcessRDW_Click</remarks>
Private Sub PopulateDataSet(ByRef rds As RawDataSet)
'Form to tell the user what the progress is....
frmWait.Show (False)
frmWait.lblWait = "Reading Data..."
'Get data from source (in this case excel)
Dim maxRow As Integer
maxRow = 3000
'Read each row and add to the RawDataSet
Dim rd As New RawData
Dim i As Integer
For i = 2 To maxRow
Set rd = New RawData
'Progress counter
frmWait.lblWait = "Reading Row... " & Format(i) & " of " & Format(maxRow)
DoEvents
'Set desired values for the current data row
rd.PartName = Sheet1.Cells(i, 1)
rd.ParentPartID = Val(Sheet1.Cells(i, 2))
rd.PartNumber = Sheet1.Cells(i, 3)
rd.FailureMode = Sheet1.Cells(i, 4)
rd.Chargeable = Val(Sheet1.Cells(i, 5))
rd.StateFS = Sheet1.Cells(i, 6)
rd.StateTime = Val(Sheet1.Cells(i, 7))
'Add row to the data set
Call rds.AddDataRow(rd)
Next i
End Sub
EDIT : Ajout des balises de code