• simonwestb (9/2/2012)


    Hi,

    I wasn't sure how to phrase my query so wasn't sure what to search for.

    I'm attempting the simplest of updates - e.g. "UPDATE CRnumbers SET StudyLocationID = " + CLocation.Text + " WHERE RegNumber = "+UserEntry.text

    UserEntry might be '12345', but how do I update for multiple entries?

    So if UserEntry has '12345,12347,12399' my super-newbie method would be to separate the comma separated values and loop through each one updating each individually, but this is obviously not the way to go.

    How do I structure my SQL to update all 3 of those values in one hit? Do I create a table from my CSVs and use that somehow or is there a simple command that understands multiple values like that?

    Thanks in advance, folks.

    There is a simple "command"

    "UPDATE CRnumbers SET StudyLocationID = " + CLocation.Text + " WHERE RegNumber IN ( "+UserEntry.text + ")"

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]