Results 1 to 8 of 8

Thread: can I open two recordsets at the same time?

  1. #1
    Addicted Member GenocideOwl's Avatar
    Join Date
    Jul 06
    Location
    Ohio
    Posts
    144

    Resolved can I open two recordsets at the same time?

    or do I need to close one, then open the other?
    Last edited by GenocideOwl; Jul 31st, 2006 at 12:51 PM.

  2. #2
    Super Moderator Hack's Avatar
    Join Date
    Aug 01
    Location
    Searching for mendhak
    Posts
    58,283

    Re: can I open two recordsets at the same time?

    Quote Originally Posted by GenocideOwl
    or do I need to close one, then open the other?
    Oh sure. You could open 50 recordsets at the same time, although I have no idea why you would.

    You do, however, need to give them different names.
    VB Code:
    1. Option Explicit
    2.  
    3. Private rsOwl As ADODB.Recordset
    4. Private rsHack As ADODB.Recordset
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  3. #3
    Hyperactive Member
    Join Date
    Feb 06
    Location
    Philippines
    Posts
    468

    Re: can I open two recordsets at the same time?

    you can also use multiple recordset but microsoft jet doesnt support them

  4. #4
    Addicted Member GenocideOwl's Avatar
    Join Date
    Jul 06
    Location
    Ohio
    Posts
    144

    Re: can I open two recordsets at the same time?

    so, since I am using MSjet, I can't open two at once?

  5. #5
    Hyperactive Member
    Join Date
    Feb 06
    Location
    Philippines
    Posts
    468

    Re: can I open two recordsets at the same time?

    you can declare two recordset like hack did but declaring 1 recordset and opening it with multiple queries is not supported by MSjet
    eg:
    rs.Open "SELECT * FROM table1 ;SELECT * FROM table2"

  6. #6
    Addicted Member GenocideOwl's Avatar
    Join Date
    Jul 06
    Location
    Ohio
    Posts
    144

    Re: can I open two recordsets at the same time?

    so I couldn't do say

    VB Code:
    1. Set cn = New ADODB.Connection 'we've declared it as a ADODB connection lets set it.
    2. cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    3. "Data Source= " & App.Path & "\CRTInventory.mdb" 'this is the connection string explained in the notes section.
    4. cn.Open
    5. Set rs = New ADODB.Recordset 'as we did with the connection
    6. rs.Open bargeDB, cn, adOpenKeyset, adLockPessimistic, adCmdTable
    7. rs2.Open "CRTInventory", cn, adOpenKeyset, adLockPessimistic, adCmdTable

  7. #7
    Hyperactive Member
    Join Date
    Feb 06
    Location
    Philippines
    Posts
    468

    Re: can I open two recordsets at the same time?

    you can open recordset as many as you want using one connection
    dim rs as adodb.recordset
    dim rs2 as adodb.recordset
    Set rs = New ADODB.Recordset
    Set rs2 = New ADODB.Recordset
    rs.Open bargeDB, cn, adOpenKeyset, adLockPessimistic, adCmdTable
    rs2.Open "CRTInventory", cn, adOpenKeyset, adLockPessimistic, adCmdTable

  8. #8
    Addicted Member GenocideOwl's Avatar
    Join Date
    Jul 06
    Location
    Ohio
    Posts
    144

    Re: can I open two recordsets at the same time?

    ok, thanks

Posting Permissions

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