Solved

AS/400 iSeries .Net Connection problem

Posted on 2007-04-09
3
695 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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 …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now