SQL 2017 / VS 2017
I am trying to write a simple script to import data from a SQL table to CRM 2016 entity. As this data transfer is only going to be used for a minimal time, I cannot justify the expense of a third party component. I have been reading that the transfer is possible using SSIS, and after looking at a few posts, I came up with the following, code, however although it compiles, when I try and run it I get a error. Can anyone help me on this bearing in mind that I know little about SSIS and my programming is 'simple'
mports System Imports System.Data Imports System.Math Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper Imports Microsoft.SqlServer.Dts.Runtime.Wrapper Imports Microsoft.Xrm.Client Imports Microsoft.Xrm.Client.Services Imports Microsoft.Xrm.Sdk #End Region ' This is the class to which to add your code. Do not change the name, attributes, or parent ' of this class. <Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute> _<CLSCompliant(False)> _ Public Class ScriptMain Inherits UserComponent Dim organisationservice As OrganizationService 'This method is called once, before rows begin to be processed in the data flow. ' 'You can remove this method if you don't need to do anything here. Public Overrides Sub PreExecute() MyBase.PreExecute() ' Dim connectionString As String = "Url=http://x.x.x.x; Username=me; Password=psw;" Dim connection As CrmConnection = CrmConnection.Parse(connectionString) organisationservice = New OrganizationService(connection) ' End Sub ' This method is called after all the rows have passed through this component. ' ' You can delete this method if you don't need to do anything here. Public Overrides Sub PostExecute() MyBase.PostExecute() ' ' Add your code here ' End Sub 'This method is called once for every row that passes through the component from Input0. ' 'Example of reading a value from a column in the the row: ' zipCode = Row.ZipCode ' 'Example of writing a value to a column in the row: ' Row.ZipCode = zipCode Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer) ' Dim _destaccountadd As New Entity("new_destinationaccounts") _destaccountadd("new_legacysql") = Row.DAccountID.ToString _destaccountadd("new_ledgerreference") = Row.LedgerRef.ToString organisationservice.Create(_destaccountadd) ' End Sub End Class
Dont ask me .. i dont know