Solved

AS/400 iSeries .Net Connection problem

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

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 …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

730 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