How can I get listbox items from a listbox, row by row. so after it reads one row it assigns a value, etc.. I want a different value for each row it reads. I know how to count them, just not how to actually read the string that is in each row.
Check the properties of a ListItem, it also has several useful features. Check your documentation, all of these answers are there in a very straightforward manner.
different variables for each. Each one will be written to a database at the end so I need one for each..unless the sql field can hold more than one and we can pull them out seprately some how.
What it is is a listbox that users can add other users to. It should go through the list box and assign each entry a string or if all of them can be sent to a sql field through one string that is fine if it is possible to pull them out and separate them later.
The problem with assigning them to separate variables is that you would have to know how many to declare, since you cannot dynamically declare variables.
I would take the second route and send one string to a stored procedure and pull them out one by one and do the insert.
the database I have has varoius fields of e1attendee1 - 10, and e2attendee1 - 10, etc. how can I make the page write to the database for the fields without creating new record entries. do it on the same record, however if they come back later that day and register more users, to create a new record and not overwrite the other one...
I have to say this is bad DB design. I would seriously chaning the design to have a related table tha holds the atendee values. Doing it the current way can lead you into lots of "dirty" coding. Beleive me I know since I deal with a DB with similar problems you are describing. The problem is you have to have a column for each attendee. What if this amount changes? Then you have to add columns. And change multiple pages of code.
I think you are right.. I will create a different table to house what i need it to and make it more clean. so maybe have table that only has:
full name, event1, event2, event3
events are boolean values
so now I need to loop through the listbox and find the selected items and assign a boolean value and write that to the database. I beleive that will be much cleaner..
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.