Sub ImportSalesPerson(ByVal aLine As String())
'get config info from the app.config file
Dim strSqlServer As String = System.Configuration.ConfigurationManager.AppSettings("SqlServer")
Dim strDatabase As String = System.Configuration.ConfigurationManager.AppSettings("Database")
Dim oeConnectType As New Microsoft.Dynamics.GP.eConnect.Serialization.eConnectType
Dim oeConnectFunctions As New GP11.eConnectFunctions(strSqlServer, strDatabase)
'instantiate our objects
Dim oRMSalespersonMasterType As New Microsoft.Dynamics.GP.eConnect.Serialization.RMSalespersonMasterType
Dim otaCreateSalesperson As New Microsoft.Dynamics.GP.eConnect.Serialization.taCreateSalesperson
Dim bSuccess As Boolean = False
Try
'populate the object from the array passed in
With otaCreateSalesperson
.SLPRSNID = aLine(0)
.SALSTERR = "TERRITORY 1"
End With
'send to the dynamics web service.
'the application will need a reference to the eConnect Web Service called 'Service1'
oRMSalespersonMasterType.taCreateSalesperson = otaCreateSalesperson
ReDim Preserve oeConnectType.RMSalespersonMasterType(0)
oeConnectType.RMSalespersonMasterType(0) = oRMSalespersonMasterType
bSuccess = oeConnectFunctions.CreateEntity(oeConnectType)
Catch ex As Exception
Throw ex
End Try