Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8627629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:19:42+00:00 2026-06-12T08:19:42+00:00

I am trying to get records from an AS400 system into Dynamics CRM programatically.

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T08:19:43+00:00Added an answer on June 12, 2026 at 8:19 am

    Just had a look at the documentation for CRMDateTime (http://msdn.microsoft.com/en-us/library/bb928935.aspx)

    This states that you can set this using the Value property (http://msdn.microsoft.com/en-us/library/bb928944.aspx)

    So you might like to try:

    cont.new_birthdate.Value = Row.DOBI20
    

    Edit

    In response to your comments, try the following

    string ConvertDate(string dateToConvert)
    { 
        dateToConvert= dateToConvert.PadLeft(7, '0');
        int c;
        int.TryParse(dateToConvert.Substring(0,1), out c);  
        c = (c * 100) + 1900;
    
        int y;
        int.TryParse(dateToConvert.Substring(1,2), out y);  
    
        return (c+y).ToString() + dateToConvert.Substring(3,4);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to get records from sql server 2005 in datetime format like this
I am trying to get my sample data (records created from fixtures) into my
I'm trying to get records from a table that have a language column. If
I am trying to get all the prime(row) numbered records from my table.Can someone
I am trying to get a list of records from a table and then
I'm trying to figure out the way to get all records from a table
I'm trying to get the last 7 records from a table whose records were
I am trying to get several records by composite index from a table having
I'm trying to get all records from a table and loop through it. Pseudo
I'm trying to get all records from my model with associated records as well

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.