Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Checkboxlist - inserting values into tables

Reply
Thread Tools

Checkboxlist - inserting values into tables

 
 
=?Utf-8?B?U2FuZHk=?=
Guest
Posts: n/a
 
      02-09-2005
I have four related tables. I need to do an insert on three of them. I
created a stored procedure that handles the insert on two of the tables
correctly . . . then I get to a tough part.

The third table consists of merely SomeID2 col from the second table and
SomeID4 that comes from the fourth table.

The fourth table is used to populate a checkboxlist and contains only
SomeID4 and a description.

In order to fill the third table, I have to loop through the checked items
in the checkboxlist and get the SomeID4 values to throw into it, along with
the SomeID2 values for each row.

I can't seem to find a way to merely put the language at the end of the
stored procedure that works. I then tried an additional stored procedure for
just the third table that I executed in a loop in my VB code. It runs
without errors, but is not filling the third table!!

I tried the following:

<snip>
Dim li as ListItem
For Each li in cblSType.Items
If li.Selected then
Dim cmd2 as New Sqlclient.SqlCommand
cmd2 = cnn.CreateCommand
cmd2 = New SqlCommand("spInsertTType", cnn)
cmd2.CommandType = CommandType.StoredProcedure
cmd2.Parameters.Add("@TID", StoreTID)
cmd2.Parameters.Add("@TFTypePK", li.Value)
End If
Next
<snip>

I tried to get the SomeID2 value from Table 2 at the beginning of the code
when I was listing the parameters for filling the tables that worked:
<snip>
cmd.Parameters.Add("@TID", 4)
cmd.Parameters("@TID").Direction = ParameterDirection.Output
Dim StoreTID As Integer
StoreTID = cmd.Parameters("@TID").Value
<snip>

Any help anyone can give me will be greatly appreciated! I've been working
on this one for hours -- I'm to the point where I'm just going round 'n round.


--
Sandy
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting into two tables JJ297 ASP .Net 2 08-17-2007 03:27 PM
Checkboxlist inside Repeater - doesn't fire click event for Checkboxlist JD ASP .Net 5 08-08-2007 11:28 AM
inserting Checkboxlist input into database wjer ASP .Net 1 03-02-2004 06:26 AM
Way to loop code for inserting Checkboxlist values into DB? wjer ASP .Net 0 02-13-2004 08:39 PM
Inserting into one table data from 2 tables and some input data. Renie83 ASP General 1 07-10-2003 08:29 PM



Advertisments