Results 1 to 5 of 5

Thread: Data access from DLL (newbie)

  1. #1
    nickthompson
    Guest

    Data access from DLL (newbie)

    I've done a bit of general VB programming in the past but am a newbie to objects.

    I'm trying to create a DLL that, when called from a web page, accesses my Access database (I have set up a system DSN), executes a SELECT query, and goes through the recordset performing some action with the data.

    It works okay when I test it in a normal VB .exe application, but when I try copying the code into a new ActiveX/DLL application it gives me an error when declaring the recordset.

    I start my code with:

    Public TempQry As QueryDef
    Public dbConnection As Connection
    Public ODBCWk As Workspace
    Public Rst As Recordset

    and when I try to compile/run my code I get an error 'User defined type not defined'. Is there something different about DLLs that means I can't use QueryDef, Recordset etc? What can I use instead to access my db?

    Thanks in advance for any help.

    Nick

  2. #2
    Lively Member
    Join Date
    Aug 1999
    Location
    Blackpool, England
    Posts
    87
    Have you added references into the DLL???
    Steve Flitcroft MCP
    .NET, VB 6.0, ASP, COM+, VBS, WSF, WSC, Exchange2000

  3. #3
    nickthompson
    Guest

    I think I've sorted it...

    I changed the database link to ADO and it seems to work (so far!)

    Thanks!

  4. #4
    Lively Member HiKsFiles's Avatar
    Join Date
    Jul 2001
    Location
    Ste-Foy, Québec, Canada (Yeah, I know ... way up north!!!)
    Posts
    71

    Question

    Hi,

    I'm having a somewhat similar problem due to my similar inexperience. héhéhé

    I created myself an activeX Dll VB project in which I declared different function to create and manipulate ADODB objects.

    My project compiles allright, I also added it to win2k components services (I guess that's the name, I'm using a French version of win2k) in order to be able to instantiate it from my ASP page.

    Now, I am able to instantiate an object from my DLL allright, but my functions don't seem to return any values.

    For example, let's say this function is declared in my dll:

    Public Function SaySomething() As String
    SaySomething = "hello world"
    End Function

    If, back in my ASP page I create an instance of my dll and then call this method and store the result in a variable, my variable is empty but I do not get any error message.

    Ex:

    dim oBDSSQ
    dim strTest

    set oBDSSQ = Server.CreateObject("SSQIntranet.BDSQL")
    strTest = "test"
    set strTest = oBDSSQ.ViveLeFromage
    Response.Write "strTest: " & strTest & "<br>"

    the result of this last output is "strTest: " only. Normally i would expect to see: "strTest: hello world" but I don't.

    What am I missing?
    Vive le fromage!
    Windows 2000 SP2 (office)
    WinXP PRO (home)

  5. #5
    Lively Member HiKsFiles's Avatar
    Join Date
    Jul 2001
    Location
    Ste-Foy, Québec, Canada (Yeah, I know ... way up north!!!)
    Posts
    71
    Damn!

    I screwed up pasting the example code. Here's the correct one:

    Ex:

    dim oBDSSQ
    dim strTest

    set oBDSSQ = Server.CreateObject("SSQIntranet.BDSQL")
    strTest = "test"
    set strTest = oBDSSQ.SaySomething
    Response.Write "strTest: " & strTest & "<br>"
    Vive le fromage!
    Windows 2000 SP2 (office)
    WinXP PRO (home)

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