writing to database

C

Childtobe

Hi, i'm writing an enquete in C# and i need to write data to a
database.
I'm using stored procedures to do so. Now the problem: I have a
question with a checkboxlist, and the user can select multiple
answers. How do i write all of them to my database?

code: (VoerAntwoordCheckBoxListToe is the name of the stored
procedure)

protected void ButtonVerzenden4_Click(object sender, EventArgs e)
{
AntwoordenCS CheckBoxListAntwoord = new AntwoordenCS();
CheckBoxListAntwoord.VoerAntwoordCheckBoxListToe(

Convert.ToInt32(Request.QueryString["vraag_ID"]),

Convert.ToInt32(CheckBoxListVraag4.SelectedItem.Value));
Response.Redirect("Vragenlijst.aspx?vraag_ID=5", true);

stored procedure:

ALTER PROCEDURE [dbo].[VoerAntwoordCheckBoxListToe]

(

@VraagID int,

@KeuzeMogelijkheid int

)

AS

/* SET NOCOUNT ON */

INSERT INTO Antwoorden(antwoord_keuze, vraag_ID)
VALUES(@KeuzeMogelijkheid, @VraagID)

RETURN

With this code a can write the first selected anwser to the database.
Now the trick is to do this for the other selected answers....
thx in advance for your help (and sorry for the crapy english :p)
 
V

Victor Bazarov

Childtobe said:
Hi, i'm writing an enquete in C# and i need to write data to a
database.
I'm using stored procedures to do so. Now the problem: I have a
question with a checkboxlist, and the user can select multiple
answers. How do i write all of them to my database?

[..]

What in the world makes you think that C# or databases are topical
here in comp.lang.c++?
 
I

Ian Collins

Victor said:
Childtobe said:
Hi, i'm writing an enquete in C# and i need to write data to a
database.
I'm using stored procedures to do so. Now the problem: I have a
question with a checkboxlist, and the user can select multiple
answers. How do i write all of them to my database?

[..]


What in the world makes you think that C# or databases are topical
here in comp.lang.c++?
Probably the same thing that made him think they were topical on
comp.lang.c!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top