Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bogdan 250 posts 427 karma points
    Jan 14, 2010 @ 14:59
    Bogdan
    0

    large number of items

    Hi,

    What is the best approach to store about 10.000 items in umbraco? They're a list of numbers, I just need to read them and be able to select and delete certain items.

    Thanks!

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Jan 14, 2010 @ 21:27
    Douglas Robar
    0

    It would be hard to give you really good advice without more information. For instance...

    • Are these 10.000 items content pages? Or is it simply one very long list of numbers?
    • Is this data already stored in a database or spreadsheet or xml or csv or some other file?
    • Who needs to view and select and delete these items? Website visitors? Umbraco content editors? Both?
    • What does it mean to 'read' the numbers?

    The more description you can give about what you're trying to achieve, the more likely the umbraco community can guide you in the best direction.

    cheers,
    doug.

  • Bogdan 250 posts 427 karma points
    Jan 15, 2010 @ 11:05
    Bogdan
    0

    Thank you very much for your reply Douglas. They are simply a very long list of numbers that will be uniquely assigned to visitors after a certain event. After this event the visitor gives a name and email, is saved as a new node and is given a random number from this list, this number must be marked as given. Now, to try to achieve this I made a table in the db, with a column for numbers and a column for the assigned data. I get a random row and fill in the assigned column with the sql command

    WITH registerCode(codeColumn, assignedColumn) AS (SELECT TOP 1 codeColumn, assignedColumn FROM codesTable WHERE assignedColumn IS NULL ORDER BY NEWID()) UPDATE registerCode SET assigned = '1234567890'

    I see that in the db random rows do get changed. What I don't know here is how to read the selected row.

    I've tried

    string connectionString = ConfigurationManager.AppSettings["umbracoDbDSN"].ToString();
                using (SqlConnection connection = new SqlConnection(connectionString))
                {
                    using (SqlCommand command = new SqlCommand(commandText, connection))
                    {
                        connection.Open();
                        using (SqlDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                Response.Write(String.Format("{0}", reader[0]));
                            }
                        }
                    }
                }

    but reader is empty. I also don't know if there's a different approach to this as I'm a beginner to both sql and c#.

     

    Have a nice day!

  • Bogdan 250 posts 427 karma points
    Jan 15, 2010 @ 15:53
    Bogdan
    0

    I got it working, just had to think a bit about what is actually happening in there :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies