VB, ADO, Oracle and Access - connection slow!!!

Results 1 to 2 of 2

Thread: VB, ADO, Oracle and Access - connection slow!!!

  1. #1
    Join Date
    Dec 1969

    Default VB, ADO, Oracle and Access - connection slow!!!

    Hi <BR><BR><BR>So I wrote the code below and when it attempts to execute the connection / sql, it takes forever. The rendering tothe screen stops and the form doesn&#039;t even show. What causes this to take so long? The query itself is very quick when run through TOAD. So it&#039;s gotta be the connection. Through the UDL file the test connection works fine and it&#039;s quick. Any ideas???? <BR><BR>connString = "&#039;Provider=MSDAORA.1;User ID=*****;Persist Security Info=False;Data Source=" & strServer & "&#039;" <BR><BR>Me.LblAlert.Caption = connString <BR>cn.ConnectionString = connString <BR>cn.Open connString <BR><BR>strSQL = "select count(distinct(person_id)) from cme_person a, dce_net_balances_table b where " <BR>strSQL = strSQL & " a.client_id = " & strClientCode & " and a.client_id = b.client_code " <BR>strSQL = strSQL & " and (b.cont_securities+b.other_securities)&#062;0" <BR><BR>MsgBox strSQL <BR><BR>rs.ActiveConnection = cn <BR>rs.Open strSQL <BR><BR>Me.[Number of lives].Value = rs(0).Value <BR><BR>cn.Close <BR>rs.Close <BR>Set cn = Nothing <BR>Set rs = Nothing <BR><BR>thanks <BR><BR><BR>Bastien <BR>

  2. #2
    Join Date
    Dec 1969

    Default Closing recordset last...

    ...This is probably generating an error. You need to close the rs first.<BR><BR>You also aren&#039;t checking to ensure the recordset has something in it. rs(0).value should fail and generate an error if the recordset is empty.<BR><BR>Of course, I also assume you are creating the ADODB.Connection and ADODB.Recordset objects ahead of time.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts