Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old July 28th, 2005, 02:01 PM
Princess Zea Princess Zea is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 97 Princess Zea User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 38 m 3 sec
Reputation Power: 4
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

Reply With Quote
  #2  
Old July 28th, 2005, 09:33 PM
Princess Zea Princess Zea is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 97 Princess Zea User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 38 m 3 sec
Reputation Power: 4
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

Reply With Quote
  #3  
Old July 29th, 2005, 12:02 PM
kcconnor's Avatar
kcconnor kcconnor is offline
Evil Republican...
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Location: Probably running over your cat right now...
Posts: 250 kcconnor User rank is Sergeant Major (2000 - 5000 Reputation Level)kcconnor User rank is Sergeant Major (2000 - 5000 Reputation Level)kcconnor User rank is Sergeant Major (2000 - 5000 Reputation Level)kcconnor User rank is Sergeant Major (2000 - 5000 Reputation Level)kcconnor User rank is Sergeant Major (2000 - 5000 Reputation Level)kcconnor User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 21 h 35 m 23 sec
Reputation Power: 37
[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?

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > Update 1 table feild with 3 values


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT