October 7, 2011 at 11:45 am
Hello,
want to strore all the data which are in the dynamic textboxes.
Mianly My requirement is their are two tables tblQuestion and tblAnswerChoices.
There columns are
for table tblQuestion
qid primary key
question ntext
and for tblAnswerChoices
ansid int primary key
qid int
answerchoice 1
tblQuestion will store the Questions created by user
tblAnswerChoices will sytore the answer choice of the question
User is free to add any number of Answer choices and for adding more choices he will press Add More
Mainly I facing problem in storing the unlimited number of choices which are created by pressing the add more
Now I think you have understand my requirement.
Thanks
Deepak
October 7, 2011 at 12:34 pm
I assume you are reffering to a web form of sorts? Need to know additional information about the end result...how have you set up the database table set up? Do you have a set number of columns in a table? Are you storing all of the data within the text boxes in a single column? How is this going to be structured in SQL?
If it's in a fixed number of columns in a table, you can try something like this:
Before you send the information from the textboxes from the form post event, iterate through the form elements and concatenate them using some type of delimiter i.e.( "|") so the data being sent to the database looks something like "abc|def|ghi|jkl|mno|" and so forth. Your stored-procedure could then have some parameter @INPUT or something like that.
Then from the stored-procedure side, call a function (written by Jeff Moden on this website) about using tally tables to split the delimited string/parameter. Then you should have no problem inserting the data into multiple columns within a table.
______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply