turfbult
Feb 22nd, 2001, 01:43 PM
Hello,
Can someone please help me to get this going. It is the first time that I
try to implement a COM into ASP. All I want the COM component to do is
connect to my DB so as to hide my uid/pwd a bit as well as for better performance.
This is my VB code which I compiled into a .dll and registered it.
My dll name is 'dbConnect.dll' and my class module is 'testCon.cls'
''VB CODE.....
'general declarations
Public cnConnect As Connection
'connect function
Public Function connected() As Boolean
'will have some error checking
Set cnConnect = New Connection
With cnConnect
.Provider = "SQLOLEDB"
.ConnectionString = "user id=me;password=you; " & _
"data source=MySource; " & _
"initial catalog = MyDb"
.Open
End With
'if no errors - connected = true - I did not add error handling for this example
connected = true
End Function
-----------------
In my asp page I previously had this. How will this now have to change
to use the .dll
<%
''ASP code
set cn = server.createobject("adodb.connection")
cn.open "dsn=Mydsn;uid=me;pwd=you"
set rs = server.createobject ("adodb.recordset")
set rs = cn.execute ("select * from myTable")
'
'
'%>
Please help, I'd love to get this going.
T
Can someone please help me to get this going. It is the first time that I
try to implement a COM into ASP. All I want the COM component to do is
connect to my DB so as to hide my uid/pwd a bit as well as for better performance.
This is my VB code which I compiled into a .dll and registered it.
My dll name is 'dbConnect.dll' and my class module is 'testCon.cls'
''VB CODE.....
'general declarations
Public cnConnect As Connection
'connect function
Public Function connected() As Boolean
'will have some error checking
Set cnConnect = New Connection
With cnConnect
.Provider = "SQLOLEDB"
.ConnectionString = "user id=me;password=you; " & _
"data source=MySource; " & _
"initial catalog = MyDb"
.Open
End With
'if no errors - connected = true - I did not add error handling for this example
connected = true
End Function
-----------------
In my asp page I previously had this. How will this now have to change
to use the .dll
<%
''ASP code
set cn = server.createobject("adodb.connection")
cn.open "dsn=Mydsn;uid=me;pwd=you"
set rs = server.createobject ("adodb.recordset")
set rs = cn.execute ("select * from myTable")
'
'
'%>
Please help, I'd love to get this going.
T