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)
 
C

childtobe

Then why are you posting to comp.lang.c?

Ah... a moment of less attention ! Apologies, my mistake, ignore this
post please, i'll copy it to the right section :)
 
R

Richard Bos

Hi, i'm writing an enquete in C#

Then you should ask in microsoft.java.badly-copied, not in comp.lang.c.
This newsgroup is for discussing C, not Sheesh.

Richard
 
M

Martin Ambuhl

Hi, i'm writing an enquete in C# and i need to write data to a
database.

That's too bad. What's even sadder is that you don't know that C# is a
proprietary product that is something other than the programming
language C. I hope that there are not employers who hire people to
write databases even though they are ignorant of such elementary things.
 
K

Keith Thompson

Martin Ambuhl said:
That's too bad. What's even sadder is that you don't know that C# is a
proprietary product that is something other than the programming
language C. I hope that there are not employers who hire people to
write databases even though they are ignorant of such elementary things.

And you felt the need to post this several hours after the original poster
wrote:

| Ah... a moment of less attention ! Apologies, my mistake, ignore this
| post please, i'll copy it to the right section :)
 
M

Martin Ambuhl

Keith said:
And you felt the need to post this several hours after the original poster
wrote:

Keith, you know about propagation of messages in newsgroups. Did you
feel an overpowering need to wait 15 hours and 19 minutes to post
something that you knew to be silly?
 
K

Keith Thompson

Martin Ambuhl said:
Keith, you know about propagation of messages in newsgroups. Did you
feel an overpowering need to wait 15 hours and 19 minutes to post
something that you knew to be silly?

My point was that it was rude of you to insult the poster on the basis
of a mistake in posting to the wrong newsgroup. There was no good
reason to assume that the poster was actually ignorant of the
difference between C and C#, even if you hadn't yet seen his later
followup.

I reject your assertion that I knew it to be silly, but I'll
acknowledge that it was probably futile; my followup was probably as
much a waste of bandwidth as yours. I suggest we both drop this, but
you can have the last word if you like.
 
K

Kenneth Brody

Keith Thompson wrote:
[...]
My point was that it was rude of you to insult the poster on the basis
of a mistake in posting to the wrong newsgroup. There was no good
reason to assume that the poster was actually ignorant of the
difference between C and C#, even if you hadn't yet seen his later
followup.
[...]

Well, given the number of posts by people who use some programming
language called "C/C++", or who post straight C++ questions, and
who need to be pointed to the group down the hall and to the left,
it sounds reasonable to me to assume that the same situation applies
to those who ask about C#.

BTW, doesn't "C/C++" invoke UB? :)

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:[email protected]>
 

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

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,281
Latest member
Pedroaciny

Latest Threads

Top