I have a form where I select from a dropdown then add a two digit code to a input box then press submit.
The submit then fires the form to a page which updates a SQL 2008 database table with the one record.
What I'd like to do is be able to add more than one "two digit code" to the input box which would in turn add more than one record. Perhaps separate the codes via a space?
E.G: If I typed in: AA BB CC. I would then get three records.
Is this possible?
Here is my working code for adding one value:
Form:
Update/add record page:
The submit then fires the form to a page which updates a SQL 2008 database table with the one record.
What I'd like to do is be able to add more than one "two digit code" to the input box which would in turn add more than one record. Perhaps separate the codes via a space?
E.G: If I typed in: AA BB CC. I would then get three records.
Is this possible?
Here is my working code for adding one value:
Form:
Code:
<form name="add" method="POST" action="add.asp">
<table width="640" border="0" cellspacing="10" cellpadding="0">
<tr>
<td width="200">Choose :</td>
<td width="172">Enter Code(s):</td>
<td width="228"> </td>
</tr>
<tr>
<td width="200"><select name="Unit" id="Unit">
<%
SQL = "SELECT Unit.Unit_ID, Unit.[Unit code], Unit.[Unit description], Business.Business_ID, Business.[Business Code], Business.[Business description] FROM Business " & _
"LEFT JOIN Unit ON Business.UnitID = Unit.Unit_ID "& _
"ORDER BY Unit.[Unit Code], Business.[Business code]"
Set rs = obj_CN.Execute(SQL, adBoolean)
nUnitID = 0
do while not rs.EOF
str_UnitID = rs("Unit_ID")
str_Unit = rs("Unit code")
str_UnitDescription = rs("Unit description")
str_BusinessID = rs("Business_ID")
str_BusinessCode = rs("Business code")
str_BusinessDescription = rs("Business description")
if nUnitID <> str_UnitID then
if nUnitID <> -1 then
Response.Write "</optgroup>"
end if
Response.Write "<optgroup label=""" & str_Unit & """>"
nUnitID = str_UnitID
end if
Response.Write "<option value=""" & str_BusinessID & """#Selected#>" & str_BusinessCode & " - " & str_BusinessDescription & "</option>"
rs.MoveNext
loop
%>
</select>
</td>
<td width="172"><input type="text" name="SystemCode" id="SystemCode"></td>
<td width="228"><input type="submit" name="Submit" value="Submit" ></td>
</tr>
</table>
</form>
Update/add record page:
Code:
<%
SQL = "INSERT INTO System ([BusinessID], [System Code], [System Description] )"
SQL = SQL & " VALUES "
SQL =SQL & "('" & Request.Form("Unit") & "', '" & Request.Form("SystemCode") & "', '" & "System Code " & Request.Form("SystemCode") & "')"
Set rs = obj_CN.Execute(SQL, adBoolean)
%>