Results 1 to 10 of 10

Thread: AS400 Connections

  1. #1

    Thread Starter
    Lively Member rabhen's Avatar
    Join Date
    Dec 2001
    Location
    Derby, Derbyshire, UK
    Posts
    79

    Question AS400 Connections

    Hi,
    Does anyone know how to send a command to an AS400?
    i have to link to a DB2 Database o the AS400 and, thogh i have the connection sorted, i don't know how to get the data from the database. i am using ADO with an ODBC connection

    Thanks in advance

    Dan

  2. #2
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    So, if you have a connection to the database, you can get a list of tables, right?

  3. #3

    Thread Starter
    Lively Member rabhen's Avatar
    Join Date
    Dec 2001
    Location
    Derby, Derbyshire, UK
    Posts
    79
    i could do, but i don't know how.. thogh when i was experimenting with the AS400 SDK it was picking up files etc.

    the problem i have is not really knowing how to send commands to the AS400 through ADO...

    any ideas..?

  4. #4
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    OK, have you any experience with ADO on, say, SQL Server, Access, Oracle?

    I have to ask these questions, because if you have no experience with ADO, you got a big learnign curve to climb...

  5. #5

    Thread Starter
    Lively Member rabhen's Avatar
    Join Date
    Dec 2001
    Location
    Derby, Derbyshire, UK
    Posts
    79
    i have use ADO with Access about 2 or 3 years back, only recently got back into VB so i am a little rusty shall we say.

    i know there is going to have to be a steep learning curve, but i cannot find anywhere to get that learning from.

  6. #6
    Junior Member
    Join Date
    Sep 2001
    Location
    Barcelona
    Posts
    26

    Post connection AS400

    you need the connection string (from a dsn) and then open the connection object. You can manage too recordsets objects...

    Daniel

  7. #7
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    Where I'm coming from is this:

    If you already have a connection to AS400 via ADO, then the utilisation of ADO commands
    should (if you follow Microsoft's mantra of many databases, one data access method) be the same as ADO with Access etc...

    So what I don't understand is that if you have your AS400 connection, and you have some ADO experience, then what's the sticking point?

    Can you post your ADO connection string?

    Cheers

  8. #8

    Thread Starter
    Lively Member rabhen's Avatar
    Join Date
    Dec 2001
    Location
    Derby, Derbyshire, UK
    Posts
    79
    The Sticking point is, having used ADO with Access so long ago,
    i can't honestly remember much about it.

    Do i need to define a variable as the Datafield or something.?


    Anyhow, here is my Connection string, and amazingly it does appear to work...


    cnTYPHOON.ConnectionString = "DSN=AS400;DRIVER={client Access ODBC data source};" & _
    "SERVER=typhoon;DATABASE=DANLIB;UID=" + strUserID + ";Password=" + strPassword + _
    ";"


    Thanks For your help

    Dan

  9. #9
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    Ah, gotcha

    OK,

    cnTyphoon.Open will get the connection open.

    After that, you can perform straight SQL using

    cnTyphoon.Execute "delete * from mytable"

    Or recordset manipulation;

    Dim cnTyphoon as New adodb.connection
    dim rs as new adodb.recordset

    cntyphoon.connectionstring = blah blah

    cntyphoon.open

    rs.Open "select * from mytable", cn, adOpenKeyset, adLockOptimistic

    etc etc

    Take a look at the ADO tutorial on VB World too - starts from the basics again...

  10. #10

    Thread Starter
    Lively Member rabhen's Avatar
    Join Date
    Dec 2001
    Location
    Derby, Derbyshire, UK
    Posts
    79
    Spot on, it works, thanks a lot Gaffer for your help!!!
    Much appreciated!

    Dan

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