Solved

AS/400 iSeries .Net Connection problem

Posted on 2007-04-09
3
713 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

635 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