p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Components Discussions specific to components in ASP 3.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Components section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 5th, 2003, 04:59 AM
Registered User
Points: 27, Level: 1
Points: 27, Level: 1 Points: 27, Level: 1 Points: 27, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating Activex DLL components

Hi there

I have been looking into find some pages with tutorials/artikles on creating DLL components but have not been able to find any. Can someone give me some links to that or give me an example on how to create Dll's ?

/vbmo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old June 5th, 2003, 09:43 AM
Friend of Wrox
Points: 2,450, Level: 20
Points: 2,450, Level: 20 Points: 2,450, Level: 20 Points: 2,450, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try these for "absolute beginner" articlers on using VB to create the DLLs:
http://www.4guysfromrolla.com/webtech/040300-1.shtml
http://www.microsoft.com/mind/0999/vbcom/vbcom.asp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old June 6th, 2003, 04:32 AM
Registered User
Points: 27, Level: 1
Points: 27, Level: 1 Points: 27, Level: 1 Points: 27, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok thanks But if there should be some tutorials/artikles on using Sql in the dll i would like those to :o)

/vbmo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old June 6th, 2003, 07:35 AM
Friend of Wrox
Points: 2,450, Level: 20
Points: 2,450, Level: 20 Points: 2,450, Level: 20 Points: 2,450, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How about these SQL and ADO tutorials?
http://www.w3schools.com/sql/default.asp
http://www.w3schools.com/ado/default.asp

any decent search engine will find you loads like these on the web...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old June 6th, 2003, 02:55 PM
Imar's Avatar
Wrox Author
Points: 33,554, Level: 80
Points: 33,554, Level: 80 Points: 33,554, Level: 80 Points: 33,554, Level: 80
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,228
Thanks: 7
Thanked 203 Times in 201 Posts
Default

Hi vbmo,

What exactly are you looking for? If I recall correctly, Microsoft has created a sample application using a VB DLL for a common Data Access Layer with methods like ExecuteSprocGetRecordSet, ExecuteSQLetc. I searched google for this, but couldn't find it anymore.

The company I work for has used this example to create our own DAL, so if you have any specific questions, feel free to ask.

Cheers,

Imar
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #6 (permalink)  
Old June 6th, 2003, 05:45 PM
Registered User
Points: 27, Level: 1
Points: 27, Level: 1 Points: 27, Level: 1 Points: 27, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar

I am simply looking for some toturials/artikles on creating dll's using VB. But the part with the "Hello World" is not enough i want to learn how to include sql and ado in my dll's :o)

/vbmo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #7 (permalink)  
Old June 7th, 2003, 08:17 AM
Imar's Avatar
Wrox Author
Points: 33,554, Level: 80
Points: 33,554, Level: 80 Points: 33,554, Level: 80 Points: 33,554, Level: 80
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,228
Thanks: 7
Thanked 203 Times in 201 Posts
Default

Hi vbmo,

I am sure there are a couple of tutorials / faqs on the net describing how to create a VB DLL using ADO, but I couldn't find one in my bookmarks. However, it's not too difficult. Using ADO in VB is more or less the same as in ASP. The biggest thing to watch for is passing parameters in and out of procedures. The type (strongly typed versus a Variant) of the parameters is important.

You can read more about that here: http://support.microsoft.com:80/supp...NoWebContent=1

OK, now for the "mini tutorial"

1. Start a new ActiveX DLL project and add a reference to the Microsoft ActiveX Data Objects 2.5/2.6

2. Create a property (type string) to hold the connection string. Alternatively, add the connection string as a hard coded value, although this is not recommended.

3. Add a method (a Sub) like ExecSproc with the following code:

Code:
Public Sub ExecSproc(ByVal NameOfSproc As String)
    '===============================================================
    '   NAME: ExecSproc
    '   DATE CREATED: 
    '   CREATED BY: 
    '   CREATED FOR: 
    '   FUNCTION: Executes a sproc that does not return any records
    '   IN: NameOfSproc. The name of the sproc to execute
    '   OUT: Nothing
    '   RETURNS: Nothing
    '   VERSION: 1
    '   EXAMPLE:
    '===============================================================

    On Error GoTo errorHandler

    Dim connConnection As ADODB.Connection
    Dim cmdCommand As ADODB.Command

    Set connConnection = New ADODB.Connection
    Set cmdCommand = New ADODB.Command

    With connConnection
        .Open YourConnectionString
    End With

    With cmdCommand
        ' Set command properties
        .ActiveConnection = connConnection
        .CommandType = adCmdStoredProc
        .CommandText = NameOfSproc
    End With

    ' Now execute without using a return value
    With cmdCommand
        .Execute , , adExecuteNoRecords
        .ActiveConnection = Nothing
    End With

    ' And clean up
    Set cmdCommand = Nothing
    Set connConnection = Nothing
    Exit Sub

errorHandler:
    If connConnection.State = adStateOpen Then
        connConnection.Close
    End If
    Set cmdCommand = Nothing
    Set connConnection = Nothing
End Sub
4. Compile the DLL and place it inside a COM+ package. See http://www.aspfree.com/authors/rober...ult.asp?aid=96 for more info on this.

5. Now you can use the DLL as follows in ASP:

Code:
Dim objDataAccess
Set objDataAccess = Server.CreateObject("MyProject.MyClassName")
objDataAccess.ExecSproc("sprocUpdatePrice")
Set objDataAccess = Nothing
As you can see, this is just a very short description of the situation. Of course you'll need more methods, properties etc to make this a successful Data Access component. Methods that you can implement are:

1. ExecSprocReturnRecordset - returns a strongly typed ADODB.Recordset
2. ExecSprocReturnArray - returns a Variant()
3. ExecSprocReturnInteger
4. ExecSQLReturnRecordset - accepts plain SQL instead of a sproc.

You'll also need a way to set up incoming parameters for the procedures.

All this code is based on the FMStocks sample site that Vertigo / Microsoft provided. If you go to http://www.fmstocks.com and download the FMStock 2000 sample project, you'll find all the stuff you need.

It looks like it's time I write a tutorial on how to create a DAL using the FMStock sample as a basis ;)

Cheers,

Imar
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #8 (permalink)  
Old June 10th, 2003, 02:56 AM
Registered User
Points: 27, Level: 1
Points: 27, Level: 1 Points: 27, Level: 1 Points: 27, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That was very usefull thanks a lot :o) Then i have just one question left, when i run a DLL under COM+ do i then not have to restart IIS when i compile my DLL again if there should be a bug in it ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #9 (permalink)  
Old June 10th, 2003, 03:23 AM
Imar's Avatar
Wrox Author
Points: 33,554, Level: 80
Points: 33,554, Level: 80 Points: 33,554, Level: 80 Points: 33,554, Level: 80
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,228
Thanks: 7
Thanked 203 Times in 201 Posts
Default

Hi there,

You don't have to restart IIS ever when using COM+ (well, under normal circumstances that is. Sometimes it hangs and needs to be restarted anyway).

Even if you fix a bug all you need to do is follow the steps in the FAQ I posted.

You should also take some time to understand the GUID principle behind COM+ DLLs. If you don't make changes to the interface of your component (add / remove methods, add / remove parameters to existing methods etc) then the GUID for your component stays the same and your component is said to be binary compatible. If you do change the interface, a new GUID is assigned and your component might break (when used in other components / applications).

In both cases, you'll need to stop the package in COM+, remove the components from the package, replace the DLL and then add them again.

HtH

Imar
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #10 (permalink)  
Old June 10th, 2003, 08:27 AM
Registered User
Points: 27, Level: 1
Points: 27, Level: 1 Points: 27, Level: 1 Points: 27, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok thats nice to know thanks for your help :o)

And in the meantime i have found this one just if you want to read it, it is also a nice artikle : http://www.asp101.com/articles/carvi...ss/default.asp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to guess around ActiveX=COM Components asgarcymed VBScript 2 December 3rd, 2007 02:08 PM
ActiveX Components in asp kishore.kumar Classic ASP Components 2 March 9th, 2007 07:53 AM
Advantages /Disadvantages of ActiveX DLL & ActiveX priyank Beginning VB 6 6 February 19th, 2007 11:34 AM
creating an activex dll amc VB Components 7 June 25th, 2004 06:10 PM
ASP & Dll Components byron Pro VB.NET 2002/2003 2 October 15th, 2003 11:16 AM



All times are GMT -4. The time now is 03:50 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc