How to insert to a db individual records from a comma-delimited list.

Hi Sirs, i'm new with programming and need a little help.
I have a product page where a user can select several channels where this product can appear.
These check boxes are then posted.
When i receive the data i get the values separated with commas.
I have managed to split the array and with ubound find the number of values but i got stuc from there.

Example. I have an array 10,13,18,22,89
I've splited the array and counted. 0 to 4

I need to store value 0 in db then value 1 .....

was my question clear?
thanks abain for you help
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Yep, you need to loop through the array and prepare the SQL for each. So here's what I'd do:
' here's your array
' split it up on the comma
theArray = split(myarray,",")
' check it;s an array so you don't get an error if not
If isArray(theArray) then
    ' set i as the marker from 0 to the upper bound -now loop through each
    for i = 0 to ubound(theArray)
        ' prepare your sql string here (i've put a ; at the end for SQL Server, the I
        ' would run the SQL at the end. Otherwise, run the sql below
        sqlstring = sqlstring & "INSERT INTO dbname (fieldname) VALUE (" & theArray(i) & ");
    ' now run the sql (sqlstring) here
End If

Hope this helped :-)

/ Tobzzz

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
aadlhAuthor Commented:
I was so close @ the same time so far.

Thanks a million
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.