|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Update 1 table feild with 3 values
Hi,
Is it possible to update a 1 table feild with 3 different values from a dynamic asp form using 3 different inputs from a from each from feild having a different names. i.e table feild is called answer feild names from the form is select checkbox radio Thanks for any help given |
|
#2
|
|||
|
|||
|
sorry I did not explain my self correctly,
I have a form that is created dynamically.The form contains questions which can have a selection of answers in form of radio button, select box or checkbox . I have put the answers of a checkbox in an array as more than one answer can be selected. So all I would like to do is on submit update the results of the checkbox with the questionid the results of the radiobutton with the questionid the results of the selectbox with the questionid an e.g of the data is below but these results are only fromthe checkboxes being updated I would like to be able to update the radiobuttons and selectbox too check = Split(Request("check"), ", ") for i = 0 to UBound(check) if trim(check(i)) <> "" then arrayVals=Split(check(i),"/") strquestid = arrayVals(0) strvalue=arrayVals(1) txtsql ="INSERT INTO answers (questionid,ID,answers) " _ & "VALUES ('"&strquestid&"', '" _ & trim(request("id")) & "','"_ & strvalue& "')" response.write("Quest ID: " & strquestid & ", Value: " & strvalue & "<br>") conn.Execute txtsql end if next QuestionId Id answer ----------- ----------- ----------- 1 128 1 1 128 2 1 128 4 1 128 8 1 128 16 1 128 32 2 128 1 2 128 2 2 128 4 2 128 8 3 128 8 Thanks for your reply |
|
#3
|
||||
|
||||
|
[QUOTE=
txtsql ="INSERT INTO answers (questionid,ID,answers) " _ [/QUOTE] An array from ASP (or any other language) cannot be stored in a single field in a SQL Server table. However: You could expand your table definition so that instead of having only 2 columns, you had several, and modified your "insert into answers" statement to be more like this: Code:
INSERT INTO ANSWERS (questionID, ID, radio1value, selectboxvalue, checkbox1, checkbox2, checkbox3, checkbox4, checkbox5) Your POST operation would need to account for each of these independent variables. You could strip each of the array elements off of the checkbox array, but why waste the CPU power on the server side since you need the data in single variables anyways? ![]() |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > Update 1 table feild with 3 values |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|