Skip to main content
Participant
May 3, 2007
Question

Update multiple records from list box

  • May 3, 2007
  • 2 replies
  • 408 views
The idea is to present a list box to allow for the selection of multiple records. The records' primary key field having been set up as the value parameter in the list box. Then use a single update statement to update all selected records with a common value.

I have tried to do this using code similar to:

UPDATE MyTable SET MyTable.MyColumn = 1 WHERE ( MyTable.MyKeyField IN ( @ListOfIntegers ) )

Where the parameter is configured thus:
<Parameter Name="@ListOfIntegers" Value='<%# ((Request.Form["MyListBox"]' Type="Int" />


The idea is that the multiple selection listbox will return a comma separated list, which should l work nicely with the WHERE [column] IN ( .. ) syntax.

Unfortunatley if more than one record is selected the Complier throws a type conversion error.

I want to do this using Dreamweaver and C# on .NET.


Any ideas how to proceed ?

This topic has been closed for replies.

2 replies

Inspiring
May 8, 2007
Are you wanting to update multiple records with the same information or
different information for each record?

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"lyleja" <webforumsuser@macromedia.com> wrote in message
news:f1cpe5$jj1$1@forums.macromedia.com...
> The idea is to present a list box to allow for the selection of multiple
> records. The records' primary key field having been set up as the value
> parameter in the list box. Then use a single update statement to update
> all
> selected records with a common value.
>
> I have tried to do this using code similar to:
>
> UPDATE MyTable SET MyTable.MyColumn = 1 WHERE ( MyTable.MyKeyField IN (
> @ListOfIntegers ) )
>
> Where the parameter is configured thus:
> <Parameter Name="@ListOfIntegers" Value='<%# ((Request.Form["MyListBox"]'
> Type="Int" />
>
>
> The idea is that the multiple selection listbox will return a comma
> separated
> list, which should l work nicely with the WHERE [column] IN ( .. ) syntax.
>
> Unfortunatley if more than one record is selected the Complier throws a
> type
> conversion error.
>
> I want to do this using Dreamweaver and C# on .NET.
>
>
> Any ideas how to proceed ?
>
>
>


May 4, 2007
This article may be helpful
http://www.drdev.net/article11.asp