Results 1 to 6 of 6

Thread: Serge or anyone re: ASP

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Virginia Beach
    Posts
    66

    Question

    Does anyone know the code to connect to a database on an AS400 using ASP/PWS? The database on the AS400 is a DB2 and i need to connect to this and display fields in a table on an webpage using ASP. Help me please I have been trying but don't know what I am doing!

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    If you have an ODBC data source setup for the AS/400 (you should have an ODBC driver for the AS/400), then you can do it like you can do with any other ODBC databases:
    Code:
    <%
        Dim cn
        
        On Error Resume Next    
        
        Set cn = Server.CreateObject("ADODB.Connection")
        cn.Open DSN=YourDSNName", "UserName", "Password"
    
        If Err.number <> 0 Then
            Response.Write "Error connection to database<BR>"
            Response.Write Err.Number & " " & Err.Description & "<BR>"
            Response.End        
        End If
    
        
        'Here do your stuff after you connect to a database...
    %>

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    ASP

    If you are after ASP you should try

    http://www.experts-exchange.com

    Free and lots of help...if you join up I could use the
    credit...vbWayne


    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Virginia Beach
    Posts
    66

    Smile

    Thankyou Serge for answering so quickly, this is working better but I still get an error that reads:

    -2147467259 [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified


    in the code that you posted above in this line:

    cn.Open DSN=YourDSNName", "UserName", "Password"


    DSN=YourDSNName I am entering what the name of the driver says when i look at settings/control panel/ODBC Datasources (32bit)/system DSN tab there is the DSN name and driver and i tried both in that part of the code. Does the name go there then I specify the driver seperately? And if so how do I specify the driver?

    Thankyou very much for your help!



    PS HeSaidJoe, I will definately look into this for future use I am just working on a deadline and just knew that one of you extremely smart people out there would know the answer! And hey, I was right!

  5. #5
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    When you creating a DSN in the ODBC applet (Control Panel), the driver is specified there along with the name for your Data source, so no other settings are required in the code.
    So if you've created a DSN for the AS/400 database, it should remember the driver as well. Instead of UserName and Password you should use the real UserName and Password for the database, either given to you by database administrator.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Virginia Beach
    Posts
    66
    I was putting in my userID and password, so I guess I will have to check with them to see if that would work. I set up the DSN of the AS400 on my machine and could even link to the tables and fields from the Get external data tab in access so I guess that would mean that the connection is good. I will have to play around with it some more and see what I can figure out. Please let me know if you have any more ideas. THANK YOU!!!!

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