Results 1 to 5 of 5

Thread: Using VB with ASP and Databases

  1. #1
    Guest

    Question

    I am just starting out with ASP. I have found the need to learn it so I can write to and display information from a Access Database on a web page. My question is this: Does anyone know where I could find a good in-depth article on how to do this? I am new to vbscript, and only programmed with Visual Basic for about 6 months. Could someone point me to a good place to start. Thanks.

  2. #2
    Addicted Member
    Join Date
    Jun 1999
    Location
    Los Angeles
    Posts
    186
    Well, this is what you need:
    I guess you by now know how to retrieve data from access from a VB form correct? if yes then
    1.You must learn how to create an ActiveX component from VB
    2.How to call the component from ASP

    Here is an example:

    for example you could have this function in a class module:

    Public Function GetData(name as string) as ADODB.Recordset

    'Get a connection to your database here
    'Set a recordset object
    'Execute a SQL query

    cnn.Open "DSN=MyDatabase"
    Set rs=new ADODB.Recordset
    set rs=cnn.Execute "Select * from table"

    'Return the recordset
    set GetData=rs

    End Function

    Make a dll. Now your COM components is known as the project name + the class name for example: MyFirstCOM.clsData

    MyFirstCOM is the name of the project and clsData is the name of the class.

    Now it's ASP time:

    <%
    set obj=Server.CreateObject("MyFirstCOM.clsData")
    set rs=Server.CreateObject("ADODB.Recordset")

    set rs=obj.GetData("André")

    if not rs.eof then
    response.write rs.Fields("LastName")
    end if

    set rs=nothing
    set obj=nothing


    %>


    Of course you need to apply your database etc.

    I hope it helps a little

    cheers
    André

  3. #3
    Guest
    Thanks for the help, but I was looking for more of a resource on the internet that has an in-depth look at what the commands mean and how to manipulate them.
    Anyone?

  4. #4
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    I have yet to find a decent resource site for ASP

    there is some on http://www.irt.org

    and bits

    http://www.ewebcity.com

    you could also look at http://www.15seconds.com but that site is mainly adverts and very dificult to navigate.

    Mark
    -------------------

  5. #5
    Guest
    Thanks for the sites. I also found this one http://www.4guysfromrolla.com/ The faq section is close to what I was looking for. Thanks for the help.

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