none
Need to update column in resultSet using imported function. RRS feed

  • Question

  • I have an imported function linked to a stored procedure on my SQL Server database.

    The function returns a resultSet which I iterate over within a for loop.

    Ideally I need to iterate through each record in the resultset, and modify it, with the changes saved back to the database.

    I first tried this by using a second imported function within the resultset loop to carry out the modification, however this caused deadlocks, suggesting that the record is locked by the first function.

    I then tried to just modify the column values and SaveChanges(), but the changes were not persisted to the database.

    Is there a way to either modify and update the results back to the SQL server within the for loop, or detatch the resultset and iterate the records.

    Each record contains 2 varbinary fields which are around 200k each, and there may be up to 200 entries in the resultset, but this has the potential to grow significantly in the future so the preferred solution would be one which minimizes the amount of data held in memory at any given time.

    I can paste code if needed, but being new to this, I suspect I am doing something dumb.

    Wednesday, December 19, 2012 10:08 PM

All replies