Anybody can point it out to me how I'm going to perform multiple query with once conn by using adodb.
As code been highlighted below has throw me an exception error, "operation is not allow when object is open"
Thanks.VB Code:
Try cnn.Open("Provider=SQLOLEDB.1;Password=sa;Persist Security Info=True;User ID=sa;Initial Catalog=Optimizer2;Data Source=LAM") Catch exc As Exception DisplayErrorMsg(DatabaseErrorMsg) End Try Dim qry As String = "SELECT PASSWORD FROM S_USER WHERE USER_ID='" & sUserName _ & "' AND PASSWORD_EXPIRE_DATE > = '" & CurrDate & "'" rstRecord.Open(qry, cnn, 3, 3) If rstRecord.RecordCount = 0 Then 'AttemptCount = AttemptCount + 1 Dim SelectCountQry As String = "SELECT FAIL_COUNT FROM S_USER WHERE USER_ID='" _ & sUserName & "'" [B] rstRecord.Open(SelectCountQry, cnn, 3, 3)[/B] Dim nFailCount As Integer = rstRecord.Fields("FAIL_COUNT").Value Dim nNewFailCount As Integer = nFailCount + 1 If (nFailCount < 3) Then Dim UpdateCountQry As String = "UPDATE S_USER SET FAIL_COUNT='" & nNewFailCount & _ "' WHERE USER_ID ='" & sUserName & "'" Dim AttemptsErrorMsg As String = "You have used" & nNewFailCount _ & "out of 3 attempts. The application will been closed if you fail at your last attempt login." DisplayErrorMsg(AttemptsErrorMsg) ElseIf nFailCount = 3 Then Dim LastAttemptsErrorMsg As String = "You have used" & nFailCount _ & "out of 3 attempts. Please consult your sdministrator for further information." DisplayErrorMsg(LastAttemptsErrorMsg) End If 'DisplayErrorMsg(NotValidUsrMsg)




Reply With Quote