|
-
Sep 15th, 2001, 03:00 PM
#1
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
-
Sep 17th, 2001, 04:56 AM
#2
Lively Member
Have you added references into the DLL???
Steve Flitcroft MCP
.NET, VB 6.0, ASP, COM+, VBS, WSF, WSC, Exchange2000
-
Sep 17th, 2001, 05:01 AM
#3
I think I've sorted it...
I changed the database link to ADO and it seems to work (so far!)
Thanks!
-
Sep 19th, 2001, 01:31 PM
#4
Lively Member
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)
-
Sep 19th, 2001, 01:33 PM
#5
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|