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"
VB Code:
  1. Try
  2.                 cnn.Open("Provider=SQLOLEDB.1;Password=sa;Persist Security Info=True;User ID=sa;Initial Catalog=Optimizer2;Data Source=LAM")
  3.             Catch exc As Exception
  4.                 DisplayErrorMsg(DatabaseErrorMsg)
  5.             End Try
  6.  
  7.             Dim qry As String = "SELECT PASSWORD FROM S_USER WHERE USER_ID='" & sUserName _
  8.             & "' AND PASSWORD_EXPIRE_DATE > = '" & CurrDate & "'"
  9.             rstRecord.Open(qry, cnn, 3, 3)
  10.  
  11.             If rstRecord.RecordCount = 0 Then
  12.                 'AttemptCount = AttemptCount + 1
  13.                 Dim SelectCountQry As String = "SELECT FAIL_COUNT FROM S_USER WHERE USER_ID='" _
  14.                 & sUserName & "'"
  15.                [B] rstRecord.Open(SelectCountQry, cnn, 3, 3)[/B]
  16.                 Dim nFailCount As Integer = rstRecord.Fields("FAIL_COUNT").Value
  17.                 Dim nNewFailCount As Integer = nFailCount + 1
  18.                 If (nFailCount < 3) Then
  19.                     Dim UpdateCountQry As String = "UPDATE S_USER SET FAIL_COUNT='" & nNewFailCount & _
  20.                     "' WHERE USER_ID ='" & sUserName & "'"
  21.                     Dim AttemptsErrorMsg As String = "You have used" & nNewFailCount _
  22.                     & "out of 3 attempts. The application will been closed if you fail at your last attempt login."
  23.                     DisplayErrorMsg(AttemptsErrorMsg)
  24.                 ElseIf nFailCount = 3 Then
  25.                     Dim LastAttemptsErrorMsg As String = "You have used" & nFailCount _
  26.                     & "out of 3 attempts. Please consult your sdministrator for further information."
  27.                     DisplayErrorMsg(LastAttemptsErrorMsg)
  28.                 End If
  29.                 'DisplayErrorMsg(NotValidUsrMsg)
Thanks.