question

MechaLaris avatar image
MechaLaris asked

SSIS 2008 Script in C#: need to convert Y2K string to date format and use it to populate variable

I am trying to get records from an AS400 system into Dynamics CRM programatically. To achieve this i have pushed the AS400 records into a SQL table and am able to push those records to CRM by referencing the CRM 4 web service endpoints in a SSIS 2008 C# script. The problem is one of the fields is in Y2K date string format. In order to get it into a date field (D.O.B) in CRM i believe i will need to convert it to a date format then reference resulting value in a variable. I do not know how to do this. This question/answer ( http://stackoverflow.com/a/4880021/1326443) may help with part of the question but i do not know how to use this into my script to get a value (haven't done any scripting for a number of years and new to C#) Script snippet: public class ScriptMain : UserComponent { private CrmService service = null; public override void PreExecute() { base.PreExecute(); CrmAuthenticationToken token = new CrmAuthenticationToken(); token.AuthenticationType = 0; token.OrganizationName = "DevOrg"; service = new CrmService(); service.Url = "http://crm/mscrmservices/2007/crmservice.asmx"; service.CrmAuthenticationTokenValue = token; service.Credentials = System.Net.CredentialCache.DefaultCredentials; } public override void PostExecute() { base.PostExecute(); } public override void LeadInput_ProcessInputRow(LeadInputBuffer Row) { lead cont = new lead(); if (!Row.TITL20_IsNull) { cont.salutation = Row.TITL20; } if (!Row.DOBI20_IsNull) { cont.new_birthdate = Row.DOBI20; } .... .... service.Create(cont); } } } *************** { cont.new_birthdate = Row.DOBI20; } throws: "cannot implicitly convert type 'string' to .....CrmSdk.CRMDateTime" Cheers
ssisc#
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.