CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    May 1999
    Posts
    12

    I need help to open a RecordSet

    I need help because I don't Know if I can open two recordset at the same time.
    For example:

    CRecordSetA RecordSetA(Database);
    CRecordSetB RecordSetB(Database);

    SelectA = "{CALL ProcedureA}"
    SelectB = "{CALL ProcedureB}"

    if (RecordSetA.Open(CRecordset::forwardOnly, SelectA, Recordset::readOnly)){
    while (!RecordSetA.IsEOF()){
    if (RecordSetB.Open(CRecordset::forwardOnly, SelectB, CRecordset::readOnly)) {
    while (!RecordSetB.IsEOF()){
    RecordSetB.MoveNext();
    }
    }
    RecordSetB.Close();
    RecordSetA.MoveNext();
    }
    }
    RecordSetA.Close();


    Can I make somthing like this?.
    If I can, What must I put in the options to make this?
    Thanks,
    Reyes


  2. #2
    Join Date
    Apr 1999
    Location
    Norway
    Posts
    19

    Re: I need help to open a RecordSet

    Hello!

    In theory you can open as many recordsets as you want. When you ask about the option, the answer is that it depends on what you need to do with the recordsets.

    I have for example an application that opens several recordsets from the same table where the purpose of every recordset is something else than all others.
    Specifically may program opens Bulck set when I am fetching records from a DB and it opens single recordsets when I modify ( new, edit and delete) a record in the Bulckset.

    Good luck
    Hussam


  3. #3
    Join Date
    May 1999
    Posts
    12

    Re: I need help to open a RecordSet

    First of all, thanks Hussam

    The second thing is that I can open several RecordSet, but my problem is that I want make this at the same time, like I show in the code of the another message, and when I try to make this the computer give me an run time error, and say that the canal is bussy.

    Have you make somthing like this?

    Chiao,
    Reyes


  4. #4
    Join Date
    Apr 1999
    Location
    Norway
    Posts
    19

    Re: I need help to open a RecordSet

    Hello again!

    Sorry that it took long time.

    As I said earlier it does not matter how many recordsets you open at the same time or not as long as you remember to close the tables when you do not need them.

    Usually the limit of open tables is between 150- 200. If you reach this limit, you will get DBException. The options you set are depending on the procedures you want to execute. I did never seen the message "Canal is busy" but it sounds like that the driver is completely occupied with an operation(-s).

    Hussam


  5. #5
    Join Date
    May 1999
    Posts
    12

    Re: I need help to open a RecordSet

    Thank you, Hussam.

    I must look why gives me this error, but I think that you are in the good way.

    "See you"

    Reyes


  6. #6
    Join Date
    May 1999
    Location
    Spain
    Posts
    335

    Re: I need help to open a RecordSet

    Jayol Reiez !

    En teoria creo que si se puede, el problema puede estar en que la base de datos se use o no de forma exclusiva ??, no se, prueba a preguntar si puedo abrir dos instancias de recordsets iguales con la misma base de datos asociada, a ver que dicen, de todas formas es muy raro,
    Ciao !
    Brous-lee


  7. #7
    Join Date
    May 1999
    Posts
    12

    Re: I need help to open a RecordSet

    Yolja, Brous-lee

    El problema es que las instancias de los recordset son distintas, es decir, que abro un objeto de una clase (CRecordSetA) y otro de otra (CRecordSetB) (con la misma base de datos en común), pero esto me dice que el canal esta ocupado. De cualquier forma con los procedimientos que tengo ahora no necesito abrir dos recordsets a la vez, lo he preguntado porque no sab*a si los iba a necesitar o no y porque me parece interesante saber como se hace.

    De cualquier forma, gracias.

    Reiez


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured