Help Please 
Author Message
 Help Please

I need to do a process that I currently do in asp in a dll, I have written a
simple activex.dll using VB6 and can pass 2 variables and get 2 back, I need
to expand this to look up a record in an access database.
can anyone provide an example of how to get a database record from within
the .dll, I have tried ado but can't seem to get it to work.

Also I need to amend the record by replacing a string with one of the passed
values, in asp I do

b = Replace(InsertCursor("supplierID"),"CookieUserID",CookieUserID,1, -1, 1)

would this work in the .dll

thanks for your help

Robert



Mon, 11 Aug 2003 19:58:30 GMT  
 Help Please
You *should* be able to use the same ADO code that you use for the ASP
within the DLL.  There are a few exceptions such as Server.Createobject
needs to be replaced with standard VB syntax.  Also remember that you need
to make sure that you can talk to your database from your test machine.

If you need more help, please provide context and maybe a code snippet.

HTH

Troy


Quote:
> I need to do a process that I currently do in asp in a dll, I have written
a
> simple activex.dll using VB6 and can pass 2 variables and get 2 back, I
need
> to expand this to look up a record in an access database.
> can anyone provide an example of how to get a database record from within
> the .dll, I have tried ado but can't seem to get it to work.

> Also I need to amend the record by replacing a string with one of the
passed
> values, in asp I do

> b = Replace(InsertCursor("supplierID"),"CookieUserID",CookieUserID,1, -1,
1)

> would this work in the .dll

> thanks for your help

> Robert



Mon, 11 Aug 2003 21:40:28 GMT  
 Help Please
Troy here is the code as it stands, i am loading the dll on to our nt server
that runs iis, the dll, database and asp calling page are all in the same
directory. vb dll code below and then how i do it in asp.

Thanks for the help

Robert

Option Explicit

'<Private>------------------------------------------
Private ReturnLink As String
'</Private>------------------------------------------

'--------------------------------------------------------------------------
'
'--------------------------------------------------------------------------
Public Function BillCard(Char As Variant, Store As Variant) As String

   Dim strSQL As String
   Dim URLHold As String
   Dim Conn As ADODB.Connection
   Dim Rst As ADODB.Recordset

   Const DBLOCATION = "dsn=stores"

     '---- Initialize Return variable
     ReturnLink = ""

     '---- Make sure they provided all the information
     If (Trim(Char) = "") Then
        Char = "CentralFund"
     End If

   '---- Find Database records

    Set Conn = New ADODB.Connection

    Conn.CursorLocations = adUseClient
    'Conn.Provider = "MSDAORA"
    Conn.ConnectionString = "Data Source=stores;"
    Conn.Open

    strSQL = "SELECT * FROM Allstores where allstores.productid = '" & Store
& "' ;"

    Set Rst = New ADODB.Recordset

    With Rst
        .Open strSQL, Conn

        If ![ProductName] = Store Then

        Reason = ![supplierid]

        End If

    End With

    If ReturnLink = "" Then
    ReturnLink = "no record - charity = " + Char + " Store =  " + Store
    End If

   ' clean up

   Set Rst = Nothing

   Set Conn = Nothing

     BillCard = ReturnLink
     Exit Function

End Function

ASP Version

sql = "select * from allstores where id = " & shop & ";"

ConStr = "Provider= MICROSOFT.JET.OLEDB.4.0; Data source=e:\.mdb"
set InsertCursor = Server.CreateObject("ADODB.recordset")
InsertCursor.ActiveConnection = constr
InsertCursor.CursorLocation = 3 'adUseServer = 2, adUseClient = 3
InsertCursor.CursorType = 1

InsertCursor.open SQL, , 1, 3
insertcursor.MoveFirst

b = Replace(InsertCursor("supplierID"),"CookieUserID",CookieUserID,1, -1, 1)

InsertCursor.Close


Quote:
> You *should* be able to use the same ADO code that you use for the ASP
> within the DLL.  There are a few exceptions such as Server.Createobject
> needs to be replaced with standard VB syntax.  Also remember that you need
> to make sure that you can talk to your database from your test machine.

> If you need more help, please provide context and maybe a code snippet.

> HTH

> Troy



> > I need to do a process that I currently do in asp in a dll, I have
written
> a
> > simple activex.dll using VB6 and can pass 2 variables and get 2 back, I
> need
> > to expand this to look up a record in an access database.
> > can anyone provide an example of how to get a database record from
within
> > the .dll, I have tried ado but can't seem to get it to work.

> > Also I need to amend the record by replacing a string with one of the
> passed
> > values, in asp I do

> > b =

Replace(InsertCursor("supplierID"),"CookieUserID",CookieUserID,1, -1,

- Show quoted text -

Quote:
> 1)

> > would this work in the .dll

> > thanks for your help

> > Robert



Mon, 11 Aug 2003 22:40:54 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

2. PLEASE HELP PLEASE HELP PLEASE HELP

3. Design Help PLEASE PLEASE PLEASE!

4. URGENT HELP PLEASE PLEASE PLEASE???

5. Help Please Please Please

6. Help, please please please!!!! Inputing a Hexadecimal Number

7. DataSource Help Please, Please, Please

8. Help Please Please Please

9. PLEASE HELP ME..HELP....PLEASE

10. PLEASE HELP ME...HELP...PLEASE

11. Any ADO help please please help sir

12. *Please Help - Please?* Experiencing problems w/Access 2000

 

 
Powered by phpBB® Forum Software