468,283 Members | 2,017 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,283 developers. It's quick & easy.

Checkboxlist - inserting values into tables

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:

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

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:
cmd.Parameters.Add("@TID", 4)
cmd.Parameters("@TID").Direction = ParameterDirection.Output
Dim StoreTID As Integer
StoreTID = cmd.Parameters("@TID").Value

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.
Nov 19 '05 #1
0 1422

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Agi Chen | last post: by
1 post views Thread by Tom | last post: by
3 posts views Thread by I am Sam | last post: by
2 posts views Thread by Patrick.O.Ige | last post: by
3 posts views Thread by Stephen | last post: by
reply views Thread by NPC403 | last post: by
2 posts views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.