JSMITH242B
Programmer
Hi Group,
I have the following code:
On the onload...
updatePermit ("updatePermit")
Function updatePermit(ByVal Action As String)
On Error GoTo Err_updatePermit
Dim objCom As ADODB.Command
Dim objRS As ADODB.Recordset
If objConn.State = adStateOpen Then
Set objCom = New ADODB.Command
With objCom
.CommandText = "xyz"
.CommandType = adCmdStoredProc
.ActiveConnection = objConn.ConnectionString
.Parameters.Append objCom.CreateParameter("RETURN_VALUE", adInteger, adParamReturnValue, 4)
.Parameters.Append objCom.CreateParameter("@function", adVarChar, adParamInput, 30, Action)
.Execute
End With
updatePermit = objCom.Parameters("RETURN_VALUE")
If updatePermit <> 0 Then
Set objRS = objCom.Execute
Do While Not objRS.EOF
strLBHF_ID = objRS.fields("HH_ID")
strreg = Trim(objRS.fields("vehicleReg"))
strClass = Trim(objRS.fields("permitclass"))
strzone = Trim(objRS.fields("permitzone"))
strValid = objRS.fields("validdate")
strexpiry = objRS.fields("expirydate")
strEnabled = objRS.fields("enabled")
ParkUpdate strLBHF_ID, strreg, strClass, strzone, strValid, strexpiry, strEnabled
' The above calls the ParkUpdate Function below.
'When the ParkUpdate Function returns to this calling Function it 'comes in on the line below (Loop) then goes to the strLBHF_ID = objRS.fields("HH_ID") line - as expected, but when I check the value of strLBHF_ID, it is still pointing at the first record and not the next one in the recordset.
Loop
objRS.Close
objConn.Close
End If
End If
Exit_updatePermit:
Exit Function
Err_updatePermit:
Resume Exit_updatePermit
End Function
Function ParkUpdate(LBHFID, VehicleReg, PermitClass, Zone, ValidDate, ExpiryDate, Enabled)
Set srvxmlHttp = CreateObject("Msxml2.ServerXMLHTTP.4.0")
Set xmldoc = CreateObject("Msxml2.DOMDocument")
FormattedValidDate = Format(ValidDate, "ddmmyyyy")
FormattedExpiryDate = Format(ExpiryDate, "ddmmyyyy")
'Connect to a WebService here...
xmldoc.loadXML (srvxmlHttp.responseText)
Dim objCom As ADODB.Command
Set objCom = New ADODB.Command
objCom.ActiveConnection = objConn
If Err.Number <> 0 Then
strResult = Err.Number
strResultDesc = Err.Description
objCom.ActiveConnection = objConn
objCom.CommandText = "pe_logParkmobileErrors"
objCom.CommandType = adCmdStoredProc
objCom.Parameters("@LBHFID") = LBHFID
objCom.Parameters("@ClientID") = 0
objCom.Parameters("@resultCode") = strResult
objCom.Parameters("@resultdescription") = strResultDesc
objCom.Execute
Else
Set objCom = New ADODB.Command
objCom.ActiveConnection = objConn '15/12/2004
objCom.CommandType = adCmdStoredProc
objCom.CommandText = "pe_updParkMobile"
objCom.Parameters("@LBHF_ID") = LBHFID
objCom.Parameters("@action") = "U"
objCom.Execute
Set objCom = Nothing
End If
Set srvxmlHttp = Nothing
Set xmldoc = Nothing
End Function
I have the following code:
On the onload...
updatePermit ("updatePermit")
Function updatePermit(ByVal Action As String)
On Error GoTo Err_updatePermit
Dim objCom As ADODB.Command
Dim objRS As ADODB.Recordset
If objConn.State = adStateOpen Then
Set objCom = New ADODB.Command
With objCom
.CommandText = "xyz"
.CommandType = adCmdStoredProc
.ActiveConnection = objConn.ConnectionString
.Parameters.Append objCom.CreateParameter("RETURN_VALUE", adInteger, adParamReturnValue, 4)
.Parameters.Append objCom.CreateParameter("@function", adVarChar, adParamInput, 30, Action)
.Execute
End With
updatePermit = objCom.Parameters("RETURN_VALUE")
If updatePermit <> 0 Then
Set objRS = objCom.Execute
Do While Not objRS.EOF
strLBHF_ID = objRS.fields("HH_ID")
strreg = Trim(objRS.fields("vehicleReg"))
strClass = Trim(objRS.fields("permitclass"))
strzone = Trim(objRS.fields("permitzone"))
strValid = objRS.fields("validdate")
strexpiry = objRS.fields("expirydate")
strEnabled = objRS.fields("enabled")
ParkUpdate strLBHF_ID, strreg, strClass, strzone, strValid, strexpiry, strEnabled
' The above calls the ParkUpdate Function below.
'When the ParkUpdate Function returns to this calling Function it 'comes in on the line below (Loop) then goes to the strLBHF_ID = objRS.fields("HH_ID") line - as expected, but when I check the value of strLBHF_ID, it is still pointing at the first record and not the next one in the recordset.
Loop
objRS.Close
objConn.Close
End If
End If
Exit_updatePermit:
Exit Function
Err_updatePermit:
Resume Exit_updatePermit
End Function
Function ParkUpdate(LBHFID, VehicleReg, PermitClass, Zone, ValidDate, ExpiryDate, Enabled)
Set srvxmlHttp = CreateObject("Msxml2.ServerXMLHTTP.4.0")
Set xmldoc = CreateObject("Msxml2.DOMDocument")
FormattedValidDate = Format(ValidDate, "ddmmyyyy")
FormattedExpiryDate = Format(ExpiryDate, "ddmmyyyy")
'Connect to a WebService here...
xmldoc.loadXML (srvxmlHttp.responseText)
Dim objCom As ADODB.Command
Set objCom = New ADODB.Command
objCom.ActiveConnection = objConn
If Err.Number <> 0 Then
strResult = Err.Number
strResultDesc = Err.Description
objCom.ActiveConnection = objConn
objCom.CommandText = "pe_logParkmobileErrors"
objCom.CommandType = adCmdStoredProc
objCom.Parameters("@LBHFID") = LBHFID
objCom.Parameters("@ClientID") = 0
objCom.Parameters("@resultCode") = strResult
objCom.Parameters("@resultdescription") = strResultDesc
objCom.Execute
Else
Set objCom = New ADODB.Command
objCom.ActiveConnection = objConn '15/12/2004
objCom.CommandType = adCmdStoredProc
objCom.CommandText = "pe_updParkMobile"
objCom.Parameters("@LBHF_ID") = LBHFID
objCom.Parameters("@action") = "U"
objCom.Execute
Set objCom = Nothing
End If
Set srvxmlHttp = Nothing
Set xmldoc = Nothing
End Function