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.
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#.
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!
It would be hard to give you really good advice without more information. For instance...
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.
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!
I got it working, just had to think a bit about what is actually happening in there :)
is working on a reply...
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.