I am running the following code trying to delete mulitple foreign language
codes from a physician's record. When I press the REMOVE FOREIGN LANGUAGE
button I only get the first record deleted instead of all the records
that I checked to get deleted. I am reloading the same page
after the button is pressed showing the user what records he/she now has
on his record. Any help would be appreciated:
DELETE STORED PROC. CODE:
'***** Determine the record(s) that will be deleted from the Physician
foreign language table. *****
If Request.ServerVariables("REQUEST_METHOD") = "POST" And
LCase(Request.Form("submit")) = "remove foreign language" Then
'***** Set up the command object to run the delete foreign lang stored
procedure. *****
Set cmdADOCommand = Server.CreateObject("ADODB.Command")
Set prmADOParameter = Server.CreateObject("ADODB.Command")
Set cmdADOCommand.ActiveConnection = ODSDev_CGuser
cmdADOCommand.CommandType = adCmdStoredProc
aryDelete_Physnforeignlang
Split(Request.Form("delete_checked_foreignlang"), ",")
For intCounter = 0 To UBound(aryDelete_Physnforeignlang)
strParmName = "id"
Set prmADOParameter = cmdADOCommand.CreateParameter(strParmName,
adInteger, adParamInput)
cmdADOCommand.Parameters.Append prmADOParameter
cmdADOCommand.Parameters(strParmName).Value = intenterprsphysnid
strParmName = "code"
Set prmADOParameter = cmdADOCommand.CreateParameter(strParmName,
adChar,
adParamInput, 5)
cmdADOCommand.Parameters.Append prmADOParameter
cmdADOCommand.Parameters(strParmName).Value
aryDelete_Physnforeignlang(intCounter)
strSQLStatement = "DelPhysnLang"
cmdADOCommand.CommandText = strSQLStatement
cmdADOCommand.Execute
'***** Clean up the parameters. *****
cmdADOCommand.Parameters.Delete("id")
cmdADOCommand.Parameters.Delete("code")
Next
End If
SELECT STATEMENT WHERE THE TABLE GETS BUILT and CHECKBOX COLUMN DEFINED:
strSQLForeignLang = "SELECT DISTINCT enterprsphysnid, foreignlangcode,
tableresult " & _
"FROM OPENQUERY(LOOKUPTABLES,'SELECT * FROM
GetLookUpTableValues_Fun(''ASTM_ForeignLang'',''a'')') " & _
"LEFT OUTER JOIN THRPhysnLang_View " & _
"ON tableargmnt = foreignlangcode " & _
"WHERE enterprsphysnid = '" & intenterprsphysnid & "' " & _
"GROUP BY enterprsphysnid, foreignlangcode, tableresult " & _
"ORDER BY tableresult "
Set physnforeignlang_rs = ODSDev_CGuser.Execute(strSQLForeignLang)
If Not physnforeignlang_rs.EOF Then
'*****Build the physician's foreign lang listing table. *****
strphysnforeignlang_table = "<TABLE width='575' align='left' border='1'
cellpadding='2' cellspacing='0'>"
strphysnforeignlang_table = strphysnforeignlang_table & "<tr>" & vbCRLF
strphysnforeignlang_table = strphysnforeignlang_table & "<th><font
face='arial' size='2'>Remove Foreign
Lang</font></th>" & vbCRLF
strphysnforeignlang_table = strphysnforeignlang_table & "<th><font
face='arial' size='2'>Foreign Lang
Code</font></th>" & vbCRLF
strphysnforeignlang_table = strphysnforeignlang_table & "<th><font
face='arial' size='2'>Foreign Lang
Description</font></th>" & vbCRLF
strphysnforeignlang_table = strphysnforeignlang_table & "</tr>" & vbCRLF
Do While Not physnforeignlang_rs.EOF
strphysnforeignlang_table = strphysnforeignlang_table & "<tr>" &
vbCRLF
strphysnforeignlang_table = strphysnforeignlang_table & "<td
align='center'><font face='arial' size='2'><input
type='checkbox' name='delete_checked_foreignlang' value='" & trim
(physnforeignlang_rs ("foreignlangcode"))
& "'></font></td>" & vbCRLF
strphysnforeignlang_table = strphysnforeignlang_table & "<td
align='left'><font face='arial' size='2'>" & trim
(physnforeignlang_rs("foreignlangcode")) & "</font></td>" & vbCRLF
strphysnforeignlang_table = strphysnforeignlang_table & "<td
align='left'><font face='arial' size='2'>" & trim
(physnforeignlang_rs("tableresult")) & "</font></td>" & vbCRLF
strphysnforeignlang_table = strphysnforeignlang_table & "</tr>" &
vbCRLF
physnforeignlang_rs.MoveNext
Loop
strphysnforeignlang_table = strphysnforeignlang_table
& "</table>" & vbCRLF
End If