Solved

AS/400 iSeries .Net Connection problem

Posted on 2007-04-09
3
701 Views
Last Modified: 2008-01-09
Greetings,
I have am using the (AS/400) iSeries .NET provider inside a VB application.  All works great with the code I will paste below except for SQL statements that join files from more then 1 Lib.    i.e.

select * from TSTDTA/myfile1 f01 inner join JACK/myfile2 f02 on f01.keyfield = f02.keyfield

That statement works fine when run directly on the iSeries but not when I use it with my function, i get an error.
 "SQL5016 Qualified object name myfile2 not valid."

 I have the following connection string...
_ConnString = "DataSource=999.999.999.999;DefaultCollection=TSTDTA;UserID=user;Password=pass"

and use the following function to fill a table in a dataset.

    Public Function fillDataSet(ByVal strSQL As String, ByVal strTableName As String, ByVal myDataset As DataSet) As Boolean
        Dim conn As New iDB2Connection
        Dim myda As iDB2DataAdapter
        conn.ConnectionString = _ConnString ' & ";Allow Zero Datetime=false"
        If IsNothing(strSQL) Or strSQL = "" Then
            Return False
        End If
        If IsNothing(strTableName) Or strSQL = "" Then
            Return False
        End If
        Try
            conn.Open()
            myda = New iDB2DataAdapter(strSQL, conn)
            myda.SelectCommand.CommandTimeout = 0
            If myDataset.Tables.Contains(strTableName) Then
                myDataset.Tables(strTableName).Clear()
            End If
            myda.Fill(myDataset, strTableName)
        Catch myerror As iDB2Exception
            Logerror("myData.filldataset", "Error:", myerror, False)
            Return False
        Catch myerror As Exception
            Logerror("myData.filldataset", "Error:", myerror, False)
            Return False
        Finally
            If conn.State <> ConnectionState.Closed Then conn.Close()
        End Try
        Return True
    End Function
0
Comment
Question by:ScottParker
3 Comments
 
LVL 24

Accepted Solution

by:
Jeff Certain earned 250 total points
ID: 18877005
I don't konw AS/400. However, the qualified names in SQL Server/T-SQL 92 are of the form database.owner.tablename. You might try this and see if it helps.
0
 
LVL 14

Assisted Solution

by:daveslater
daveslater earned 250 total points
ID: 18881050
Hi try

select * from TSTDTA.myfile1 f01 inner join JACK.myfile2 f02 on f01.keyfield = f02.keyfield

Dave
0
 
LVL 3

Author Comment

by:ScottParker
ID: 18885047
Yesterday when I wrote this I swear the "." did not work.
Today it does.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB.NET 2008 (3.5 Framework) Remove all items from List 3 22
Regex validation 2 25
Error handling in asp.net site 5 28
RLDC Reporting in Visual studio 11 16
This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question