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

  • SEARCH
  • Home
  • 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 8584147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:42:15+00:00 2026-06-11T21:42:15+00:00

So I have a checkboxlist on an ASP.NET form. I need the IDs of

  • 0

So I have a checkboxlist on an ASP.NET form. I need the IDs of the selected checkboxes as part of an IN clause in a stored procedure (SQL Server 2008). Quite straightforward really – let’s say the user selects 1, 2, 4, 7, then my procedure would ask for values where TranCode IN (1,2,4,7). Since I can’t do a dynamic IN statement, and I don’t want to build the query dynamically, I thought XML would be a good choice.

I’m building the XML string thusly in VB.NET – <chargecode><refnum>1</refnum><refnum>2</refnum></chargecode>, etc. TranCode and RefNum represent the same fields, they are just named differently between the transaction table and description table, so I can change refnum to something else in my XML if need be, but I’m definitely going to have to use TranCode for the comparison column.

In my stored procedure I’ve declared an XML variable called @ChargeCodesXML, which will contain the XML string passed in from VB.NET. Basically all I need to do is pull all the refnum fields out of the XML file for comparison against TranCode. The procedure has several joins, some aggregate functions, group bys, etc., but basically I want something like

SELECT * FROM SomeTable WHERE TranCode IN (SELECT RefNum FROM MyXMLFile)  

I’ve been searching around and have seen many complex XML queries, but nothing as simple as what I need, so I’m kind of overwhelmed by the examples I’m seeing. Can someone please tell me how to modify my proc for this very simple comparison?

Thanks!
Mike

  • 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-11T21:42:16+00:00Added an answer on June 11, 2026 at 9:42 pm
    SELECT * 
    FROM SomeTable 
    WHERE TranCode IN (
                      SELECT T.N.value('(./text())[1]', 'int')
                      FROM @ChargeCodesXML.nodes('/chargecode/refnum') AS T(N)
                      )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a checkedlistbox in asp.net web form page as : <asp:CheckBoxList ID=TagListCheckBox runat=server
I have an ASP.NET server control that inherits from CheckBoxList that renders the controls
I am using CheckBoxList control of Asp.Net. In order to get selected checkboxes i
Greeting, if I have asp.net checkboxlist control : <asp:CheckBoxList id=list1 runat=server> <asp:ListItem>One</asp:ListItem> <asp:ListItem>Two</asp:ListItem> <asp:ListItem>Three</asp:ListItem>
I have a Web User Control that contains a CheckBoxList. MyListControl: <asp:checkboxlist id=chkList runat=server>
I have an asp.net panel that contains a checkboxlist. I'd like to resize it
I have some checkboxlist like this: <asp:CheckBoxList ID=G1 runat=server> <asp:ListItem Value=Comunicações Unificadas Text=Comunicações Unificadas
If I have the following CheckBoxList <asp:CheckBoxList ID=typeCheckBoxList runat=server RepeatDirection=Horizontal> <asp:ListItem Value=0>Student</asp:ListItem> <asp:ListItem Value=1>Parent</asp:ListItem>
I am using ASP.NET checkboxlist control. On the page I have a hyperlink. On
I need to manipulate the attributes of a label element inside an ASP.NET CheckBoxList

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.