COM object DLL and recordsets

Results 1 to 2 of 2

Thread: COM object DLL and recordsets

  1. #1
    Join Date
    Dec 1969

    Default COM object DLL and recordsets

    I want to call a VB6.0 activex.dll com object from within ASP(interdev). I need a way to pass a policy# to a fuction and Lookup the record in SQL(do some calcs and pass the results). When I create a class in VB. Database, recordset access isn&#039t available, so How do I access a database in a VB Class? <BR>The following test works in a VB form not a Class:<BR><BR>Dim db As New adodb.Connection<BR>Dim rs As New adodb.Recordset<BR>Dim sql As String<BR>Dim policy As String, value As String<BR><BR>policy = "BAQT001369"<BR>db.Open "fileDSN=test;uid=;pwd="<BR>sql = "select * from dwbp130 where policy = &#039" & policy & "&#039"<BR>MsgBox sql<BR>rs.Open sql, db<BR>rs.movefirst<BR>value = rs.fields("trans")<BR>MsgBox value<BR>rs.Close<BR>db.Close<BR><BR>Please email me ASAP with the results? Thanks<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: COM object DLL and recordsets

    Your code will work in a form, but not in a class because you&#039re not calling that function from anywhere. In your ASP, you&#039ll have to register the component and call one of it&#039s functions. Secondly, you don&#039t have this in a function or whatever. I do database calls exclusively from COM all the time... in order for you to see if this works, add a form to your Class project, and "pretend" that&#039s your ASP. You&#039ll have to add the reference to the class in your project first. Also that way, you can step through in the debugger looking at all the values instead of sending msgbox&#039s. So do something in your class like:<BR><BR>Public Function MyFunction(inputvalues) as variant<BR>&#039Place your code here<BR>End Function<BR><BR>Then, in ASP:<BR><BR>Dim MyVariable, MyReturn<BR><BR> Set MyVariable = Server.CreateObject("ProgID")<BR> MyReturn = MyVariable.MyFunction(inputvalues)<BR><BR>Everythi ng should work fine then.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts