Wrox Programmer Forums
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 11th, 2004, 04:56 PM
Authorized User
 
Join Date: Aug 2003
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default ADO and AS400

Hi Folks,

I want write a windows application that would allow other windows applications to work with AS400 data (read and write). I decided to use ADO w/VB 6.0 instead of ADO.NET due to lack of availability of documentation and failure of several tests.

So far, I have been successful at fetching data from AS400 and updating it using a connected recordset with cursor location set to server (CursorLocation = adUseServer).

However, I would like to use disconnected recordset w/location set to client. Here is the problem: AS400 system doesn't run DB2, but is used as a flat file storage, and I have no metadata about the tables (somehow files are organized as tables). However, applications using this tool will know about the metadata of the tables they work with. In the code below, as soon as I change adUseServer to adUseClient, it fails on Update and throws an error:

Run-time error '-2147467259(80004005)':
Insufficient base table information for updating or refreshing


Code:

Public Function GetData() As adodb.Recordset

    Dim adoCnxn As New adodb.Connection
    Dim adoCmd As New adodb.Command
    Dim adoRecSet As New adodb.Recordset

    'adoCnxn.CursorLocation = adUseServer
    adoCnxn.ConnectionString = m_strConn
    adoCnxn.Open (m_strConn) 'required

    With adoCmd
        .CommandText = m_strCmd
        .CommandType = adCmdText
        .ActiveConnection = adoCnxn
        .Properties("Updatability") = 1 + 2 + 4
        'excluding Properties setting doesn't change anything
        'supposedly it is to tell IBM to enable delete, modify, insert
    End With

    adoRecSet.CursorType = adOpenKeyset
    adoRecSet.LockType = adLockOptimistic
    adoRecSet.ActiveConnection = adoCnxn
    adoRecSet.CursorLocation = adUseClient
    ------------->'adUseServer works just fine


    adoRecSet.Open adoCmd

    adoRecSet.Update "MID", "AP" 'update field called MID
    -------> fails right here on Update

    Set GetData = adoRecSet
End Function




Please help!!


 
Old March 27th, 2004, 02:34 AM
Registered User
 
Join Date: Mar 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

do you mind me asking what is the connection string you are using to connect to the as400? are you using any middleware or does your connection string allow direct access to the as400?

id appreciate some help because im having difficulty connecting to an as400 using ado and im unsure about the connection string.

thanks!

 
Old March 27th, 2004, 04:07 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Take a look here:
http://www.able-consulting.com/MDAC/...orAS400FromIBM

It lists all kinds of connection strings, including a few for an AS400 connection.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dummy AS400 butter Javascript How-To 1 October 28th, 2008 02:08 AM
AS400 (Its a long shot) interrupt Javascript How-To 1 March 18th, 2005 10:03 AM
Connecting to AS400 via ODBC andrew VB.NET 2002/2003 Basics 1 January 3rd, 2005 07:43 AM
Working with IBM AS400 texasraven ADO.NET 9 August 20th, 2004 12:05 PM
IBM AS400 + VB - retrieving AS400 file definitions gattsi Pro VB Databases 1 July 23rd, 2004 12:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.