程序:
If Val(retcode) = 2 Then '扣款成功
sqlstr = "update set status=30,note2=date_str from gspldkinfo where note1='" & num & "'"
If rs.State <> adStateClosed Then rs.Close
End If
rs.Open sqlstr, dbconnect, adOpenKeyset, adLockOptimistic
ElseIf Val(retcode) = 3 Then '扣款失败,余额不足
' sqlstr = "update set status=40,note2=date_str from gspldkinfo where note1='" & num & "'"
If rs.State <> adStateClosed Then rs.Close
End If
rs.Open sqlstr, dbconnect, adOpenKeyset, adLockOptimistic
end if
上面的判断语句在执行到elseif的时候,就报“else没有if”的错,请大家教我,错在哪里?
If Val(retcode) = 2 Then '扣款成功
sqlstr = "update set status=30,note2=date_str from gspldkinfo where note1='" & num & "'"
If rs.State <> adStateClosed Then rs.Close
End If
rs.Open sqlstr, dbconnect, adOpenKeyset, adLockOptimistic
ElseIf Val(retcode) = 3 Then '扣款失败,余额不足
' sqlstr = "update set status=40,note2=date_str from gspldkinfo where note1='" & num & "'"
If rs.State <> adStateClosed Then rs.Close
End If
rs.Open sqlstr, dbconnect, adOpenKeyset, adLockOptimistic
end if
上面的判断语句在执行到elseif的时候,就报“else没有if”的错,请大家教我,错在哪里?
If Val(retcode) = 2 Then '扣款成功
sqlstr = "update set status=30,note2=date_str from gspldkinfo where note1='" & num & "'"
If rs.State <> adStateClosed Then rs.Close
End If
rs.Open sqlstr, dbconnect, adOpenKeyset, adLockOptimistic
ElseIf Val(retcode) = 3 Then '扣款失败,余额不足 ''''这里就会出错
sqlstr = "update set status=40,note2=date_str from gspldkinfo where note1='" & num & "'"
If rs.State <> adStateClosed Then rs.Close '''这句语句不对应End If
End If '''多出来的
rs.Open sqlstr, dbconnect, adOpenKeyset, adLockOptimistic
end if '''多出来的
sqlstr = "update set status=30,note2=date_str from gspldkinfo where note1='" & num & "'"
If rs.State <> adStateClosed Then rs.Close
rs.Open sqlstr, dbconnect, adOpenKeyset, adLockOptimistic
ElseIf Val(retcode) = 3 Then '扣款失败,余额不足
' sqlstr = "update set status=40,note2=date_str from gspldkinfo where note1='" & num & "'"
If rs.State <> adStateClosed Then rs.Close
rs.Open sqlstr, dbconnect, adOpenKeyset, adLockOptimistic
end if