BC30807: 'Let' and 'Set' assignment statements are no longer supported.

Hi I have ajavascript function in asp site which i am trying to use on asp.net page. Basically on asp page .I have a text box and a drop down list on asp form when a value is selected from dropdown the textbox get filled that value. The following javascript function is being called onchange event of the text box. Suppose user changes the values of the item code a javascript error should pop up.

function GetItemName(myitem)
{
var itemCodeArray = new Array()
var itemNameArray = new Array()
var item_code
var varitem_name = "**ERROR**"
var iii
{
if (myCmdty.length = 0) return true;
}
<%  dim i3 %>
<%  i3 = 0 %>
<%  sql = "select item_code, item_name from items where item_code <> 1 and item_code <> 4 and item_code <> 10order by item_code"  %>
<%  set RecordSet=ODBCConnect.Execute (sql)   %>
<%  ' now grab all the records and put it in an array   %>
<%  do while not RecordSet.eof    %>
<%       response.write "itemCodeArray " & "[" & i3 & "]" & "=" & Recordset.fields(0)& ";" %>
<%       response.write "itemNameArray" & "[" & i3 & "]" & "='" & Recordset.fields(1)& "';" %>
<%       i3 = i3 + 1   %>
<%       RecordSet.movenext    %>
<% loop    %>
for (iii = 0; iii <= 40; iii++)
  {
  if (itemNameArray[iii] == myitem)
      {
      varitem_name = itemNameArray [iii]
      break
      }
  }
{
if (varitem_name == "*ERROR*")
      {
       alert("Bad item code entered.");
       return false;
      }
else
      {
      document.My_form.item_name.value = varitem_name;
      return true;
      }
}
}

When I am trying to use this function in asp.net form i get error message BC30807: 'Let' and 'Set' assignment statements are no longer supported.
 How can I modify this function ?
PNKJAsked:
Who is Participating?
 
Arthur_WoodConnect With a Mentor Commented:
this block:

<%  dim i3 %>
<%  i3 = 0 %>
<%  sql = "select item_code, item_name from items where item_code <> 1 and item_code <> 4 and item_code <> 10order by item_code"  %>
<%  set RecordSet=ODBCConnect.Execute (sql)   %>
<%  ' now grab all the records and put it in an array   %>
<%  do while not RecordSet.eof    %>
<%      response.write "itemCodeArray " & "[" & i3 & "]" & "=" & Recordset.fields(0)& ";" %>
<%      response.write "itemNameArray" & "[" & i3 & "]" & "='" & Recordset.fields(1)& "';" %>
<%      i3 = i3 + 1   %>
<%      RecordSet.movenext    %>
<% loop    %>


can be greatly simplified(cleaned up) as:

<%  dim i3
        i3 = 0
        sql = "select item_code, item_name from items where item_code <> 1 and item_code <> 4 and item_code <> 10order by item_code"
        RecordSet=ODBCConnect.Execute (sql)
        ' now grab all the records and put it in an array
        do while not RecordSet.eof
           response.write "itemCodeArray " & "[" & i3 & "]" & "=" & Recordset.fields(0)& ";"
           response.write "itemNameArray" & "[" & i3 & "]" & "='" & Recordset.fields(1)& "';"
           i3 = i3 + 1
           RecordSet.movenext  
       loop    %>

AW
0
 
TimCotteeHead of Software ServicesCommented:
Hi PNKJ,

 <%  set RecordSet=ODBCConnect.Execute (sql)   %>

Should be

 <%  RecordSet=ODBCConnect.Execute (sql)   %>


Tim Cottee
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.