ADO API and IN

2 posts, 1 answers
  1. yjh
    yjh avatar
    67 posts
    Member since:
    Aug 2007

    Posted 23 Sep 2011 Link to this post

    How to using ADO API to delete records as following:

    DELETE FROM TableName WHERE ID IN (@IDS)

    In fact that is, how to pass in the parameter "IDS" , assume I want to delete records in table "TableName", and the primary key is "ID", and I have a Guid[] IDS which contains the ID of records to delete.
  2. Answer
    Damyan Bogoev
    Admin
    Damyan Bogoev avatar
    581 posts

    Posted 26 Sep 2011 Link to this post

    Hello Yjh,

    I am afraid that you are unable to achieve that goal. The OAParameter can only be a single value. Actually you could workaround that by replacing the “@IDS” parameter with the correct GUID values:
    query = query.Replace("@IDS", string.Join(guidArray), ","));

    Hope that helps.

    Greetings,
    Damyan Bogoev
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>

  3. DevCraft banner
Back to Top