Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

AS/400 iSeries .Net Connection problem

Posted on 2007-04-09
3
Medium Priority
?
722 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 1000 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 1000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 …
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 …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

671 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