Currently working on a little project which is taking information from a SQL Server. I have a code that read’s like such:
var Item = listname.selected;
If (sqlreturndata == “1”)
{
Itemlist.selected = “item name”;
}
If (sqlreturndata == “2”)
{
Itemlist.selected = “other name”;
}
If (sqlreturndata == “3”)
{
Itemlist.selected = “another”;
}
And it goes on to 50+ numbers…
How can I make the script more efficient/clean/smaller?
var Item = listname.selected;
If (sqlreturndata == “1”)
{
Itemlist.selected = “item name”;
}
If (sqlreturndata == “2”)
{
Itemlist.selected = “other name”;
}
If (sqlreturndata == “3”)
{
Itemlist.selected = “another”;
}
And it goes on to 50+ numbers…
How can I make the script more efficient/clean/smaller?