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

    Problem with data source class

    Hi!

    I've developed a simple savings bank application in Visual Basic that uses a Microsoft Access 97 database. I'm trying to modify it by splitting it into components.

    I've compiled the class responsible for connecting to the database into an ActiveX .exe component. Since doing that though, a class CParameters, that I created as a data source class in the main project, seems to cause an error in the calling class CApplication (also in the same project). It returns the error "Interface not registered."

    This error occurs when the CApplication class tries to set a recordset object to the data source with this line of code:


    set rs.DataSource = theCParameters




    I've checked that the database component returns the required data, it is after control is returned to the data source class that the error occurs. Why does it occurr only after I've used a component? VB help was not helpful.

    Guidance needed
    Chay


  2. #2
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: Problem with data source class

    I'm not sure that you can an ADO recordset's datasource to a custom data provider. you should be able to set a control's data source to your data source class though - at run time. i also dont understand why you would want to set a recordset's data source equal to what is virtually another recordset. if your data source class already has the data in it, why move it to another recordset? if you need some functionality that the ADO rs has, can you implement it in your data class? if you need to expose the entire collection of records in your data source, you should be able do that with minimal coding (a property collection of individual records).

    anyway, as for your error, one question: - why compile the connection class into a out of process server? granted - it is more stable in that if that object encounters a fatal error your calling process will not fail as well, but you take a performance hit by doing that. (on today's machines though - i'm not sure one would notice). secondly, i assume you have registered the exe by running the exe and passing the /register switch (MyActiveX.exe /register).

    if you have registered the server (the exe) can you at least create the object and get data from it before trying to assign to the recordset? if not, try doing that first to ensure that it is working as expected.

    just some ideas,

    john

    John Pirkey
    MCSD
    http://www.ShallowWaterSystems.com
    http://www.stlvbug.org
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

  3. #3
    Join Date
    May 2000
    Posts
    3

    Re: Problem with data source class

    Thanks for that reply. Actually, when all the classes were in a single project, I was able to set the recordset's datasource to the data source class and it worked okay. Your point is well taken though about setting it to another recordset. When I first developed the application I was in the process of learning the new features of VB6 which is why I used the data source class. I've already seen that I can do without it, and I've called the data connection component directly to retrieve the required data.

    The reason I'm using an out of process exe is for flexibility. I want it to run on a physically separate server computer, the same that the database is on (I want to convert the database to a SQL server database). This is all new to me by the way and I really am just experimenting.

    Thanks for your help.

    Chay


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