System.ArgumentOutOfRangeException = Index and length must refer to a location within the string

Posted on 2010-01-04
Last Modified: 2012-05-08
[System.ArgumentOutOfRangeException]      {"Index and length must refer to a location within the string.\r\nParameter name: length"}      System.ArgumentOutOfRangeException

Here is the sql statement:

"insert into ImportedData (BatchID, Date, Clientip, Firstname, Zip, Email) values ('20100104145312', 'April 20, 2009, 8:17 pm', '', 'Rene\\''', 'Webster', '')"

Strange, cuz when I try to run this in My-SQLFront --- it runs with no problems.

I think maybe it has something to do with what is trying to go into Firstname column --  Rene\\

but not sure how to fix.

Thank you,

Question by:knowlton
    LVL 13

    Accepted Solution

    your date format is incorrect - remove the commas
    (I have purposefully used the replace function so you can use it on a varchar variable)

    insert into ImportedData (BatchID, Date, Clientip, Firstname, Zip, Email) values ('20100104145312', replace('April 20, 2009, 8:17 pm', ',', ''), '', 'Rene\\''', 'Webster', '')

    Open in new window

    LVL 5

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL ( several years ago, it seemed like now was a good time to updat…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now