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 3945592
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:02:03+00:00 2026-05-20T01:02:03+00:00

I have a repeater with about 100 rows, and 4 columns in each row.

  • 0

I have a repeater with about 100 rows, and 4 columns in each row. something like this table:

Username        HasIpod        HasGymMembership        HasCar
``````````````````````````````````````````````````````````````
User1            chcekbox        checkbox               checkbox
User2            chcekbox        checkbox               checkbox
User3            chcekbox        checkbox               checkbox
User4            chcekbox        checkbox               checkbox

well, you get the idea.

The admin can tick/untick any box anytime and click on a “Save” button at the end of page and thats when I need to update the database. I need to add a row in one of the table if a certain checkbox is checked, delete it if its unchecked.

I can just loop through the repeater and VERY EASILY do it with each row. but my concern is that, at the worst case, this will use about 100 rows X 3 = 300 database accesses. Thats bad right?

I thought of concatenating all values into a form of csv.. something like:

user1id,1,0,1;user1id,0,1,1

just a list of userid, its values separated with , and the next user’s values separated with ; and in the database I can just use a split function and a bunch of while loop and update accordingly.

but It just doesnt satisfy me for some reason. Is there a better way to deal with a such a situation? I am sure this is not a unique case, what do you guys do in a scenario? any insight about being a super fast “ninja” in this (with as little db access as possible) would be great.

thanks.

  • 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-05-20T01:02:03+00:00Added an answer on May 20, 2026 at 1:02 am

    instead of csv you can use xml, like this:

    DECLARE @DocHandle int
    DECLARE @XmlDocument nvarchar(1000)
    SET @XmlDocument = N'<ROOT>
    <User Username="user1" HasIpod="1" HasGymMembership="1" HasCar="0" />
    <User Username="user2" HasIpod="1" HasGymMembership="0" HasCar="1" />
    <User Username="user3" HasIpod="0" HasGymMembership="1" HasCar="0" />
    <User Username="user4" HasIpod="0" HasGymMembership="0" HasCar="1" />
    </ROOT>'
    
    EXEC sp_xml_preparedocument @DocHandle OUTPUT, @XmlDocument
    
    SELECT *
    FROM OPENXML (@DocHandle, '/ROOT/User',1)
          WITH (Username  varchar(100),
                HasIpod bit,
                HasGymMembership bit,
                HasCar bit)
    
    /* ... update your tables here ... */
    
    EXEC sp_xml_removedocument @DocHandle
    

    UPDATE:
    another way, assuming you use dirty state

    DECLARE @DocHandle int
    DECLARE @XmlDocument nvarchar(1000)
    SET @XmlDocument = N'<root>
        <added>
            <ipod userID="1" />
            <ipod userID="2" />
            <gym userID="1" />
            <gym userID="3" />
            <car userID="2" />
            <car userID="4" />
        </added>
        <removed>
            <ipod userID="3" />
            <ipod userID="5" />
            <gym userID="4" />
            <gym userID="5" />
            <car userID="1" />
            <car userID="3" />
        </removed>
    </root>'
    
    EXEC sp_xml_preparedocument @DocHandle OUTPUT, @XmlDocument
    
    insert into HasIPodTable SELECT * FROM OPENXML (@DocHandle, '/root/added/ipod',1) WITH (userID  int)
    delete HasIPodTable where userID in (SELECT * FROM OPENXML (@DocHandle, '/root/removed/ipod',1) WITH (userID  int))
    
    /* and the same for the others ... */
    
    EXEC sp_xml_removedocument @DocHandle
    

    that’s of course assuming you have 3 tables (ipod, gym, car). if not, then just update the Users table

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Repeater Control and in that i have code like this <div runat=server
I have a repeater of div's that look a little bit like this: <div
I have a repeater like this: <asp:Repeater runat=server ID=pde> <HeaderTemplate></HeaderTemplate> <ItemTemplate> <asp:Literal runat=server ID=literal1></asp:Literal>
I have read some articles about this matter... and it seems that the Repeater
I have a repeater for showing my data . this repeater showing 2 field
I have some tables in my database with about 7K rows and I need
I have a repeater which binds a set of data. Within this repeater is
Here's the scenario: I have a repeater inside an UpdatePanel called updPanel. Inside this
I'm using a repeater ListOfArticles and have controls inside it like ddlSizes and btnSelectArticle
So, this question may be a little vague, but I have constant discussions about

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.