Results 1 to 2 of 2

Thread: COM component

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Question

    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

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Set myObject = server.createobject("dbConnect.testCon")


    connectboolean = myobject.Connected
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

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