Question
Update multiple records from list box
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 ?
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 ?
