473,396 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Need to check file exsits on AS400 server using Winform Application

Hi,
I am working on a Windows Application where i need to check a file exists in particular library with user crediantials.
Please suggest how to do it.

Note : .Net framework 1.1 (VS2003)
Dec 9 '09 #1
4 4603
But it is in remote server , and it is a AS400 server ,We might need to provide user id and password
Dec 9 '09 #3
Frinavale
9,735 Expert Mod 8TB
Oh wow, with a bit of searching, it looks like you can do this with ODBC!!

Obviously I haven't tried this myself because I don't have an AS400 of my own...I took the following code from a google search:
Expand|Select|Wrap|Line Numbers
  1. 'Define the ODBC Connection string
  2.  Dim MyODBCConnection As New OdbcConnection("Driver={Client Access ODBC Driver (32-bit)};" & _
  3.         "System=AS400Name;" & _
  4.         "TRANSLATE=1;" & _
  5.         "Uid=UserID;" & _
  6.         "Pwd=User Password")
  7. 'Open the connection
  8.         MyODBCConnection.Open()
  9.  
  10. 'Define the SQL statement to extract the data from the AS400
  11. Dim selectCMD As OdbcCommand = New OdbcCommand("SELECT * FROM LIBRARY.FILE WHERE FILEFIELD='YourChoice' order by FILEFIELD", MyODBCConnection)
  12.  
  13. 'Initialize the reader
  14. Dim dr As OdbcDataReader = selectCMD.ExecuteReader
  15.  
  16. Try
  17. 'Set the mouse to show a Wait cursor
  18.             Me.Cursor = Cursors.WaitCursor
  19. 'start the Read loop
  20.             While dr.Read
  21. 'Note: the numbers in double quotes represent the column number from the AS400 database
  22. 'Add the data to the list view
  23.                 Dim listItem As New ListViewItem(dr.GetString("2"))
  24.                 listItem.SubItems.Add(dr.GetString("3"))
  25.                 ListView1.Items.Add(listItem)
  26. 'End the loop
  27.             End While
  28. 'Reset the cursor
  29.             Me.Cursor = Cursors.Default
  30.  
  31.         Catch ex As Exception
  32.         End Try
  33.  
  34. 'Close the connection
  35.  MyODBCConnection.Close()
  36.  MyODBCConnection.Dispose()
-Frinny
Dec 9 '09 #4
Hi Frinavale,
The AS400 server is iSeriesDB2. i added IBM.DB2.ISeries.dll to reference and added and tried following code , but getting exception in first line . please let me know if i need to install any drivers or any other dll.
Expand|Select|Wrap|Line Numbers
  1. Dim cn As iDB2Connection = New iDB2Connection
  2. Dim cmd As iDB2Command = cn.CreateCommand()
  3. Dim dataFromTable As String
  4. cmd.CommandText = "select * from file1"
  5. cn.ConnectionString = "DataSource=xyz; Naming=System; LibraryList="
  6. dataFromTable = CType(cmd.ExecuteScalar(), String)
  7. cn.Open()
  8. cn.Close()
Exception:
An unhandled exception of type 'IBM.Data.DB2.iSeries.iDB2DCFunctionErrorException ' occurred in ibm.data.db2.iseries.dll

Additional information: Exception calling CwbDc.GetConstants from iDB2Constants constructor.
Dec 9 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: mechweb | last post by:
I am trying to connect to a DB2 database on an AS400 via ASP. On the server I can connect fine using VB, but keep getting a communcation link failure when using the exact same code in ASP. Here is...
2
by: Cigdem | last post by:
Hello, I am trying to parse the XML files that the user selects(XML files are on anoher OS400 system called "wkdis3"). But i am permenantly getting that error: Directory0: \\wkdis3\ROOT\home...
2
by: Bobby | last post by:
Hello everyone I have a question. The school I am working for is in the beginning process of having a webpage that will direct students to download there homework and be able to view there info...
2
by: Niyazi | last post by:
Hi, Our company uses IBM AS400 and DB2 (version 4.5 I guess). I have to do some report but I donot know how to access the AS400 DB2. I search IBM unfortunately IBM site in mess. Can anyone tell...
6
by: Niyazi | last post by:
Hi, We have and IBM AS400 and I belive the reional setting is Turkish. The IBM Client-Access for Windows that install in our PC (WIN XP SP2) set to Turkish characters. Now my PC has English...
4
by: Scott Holland | last post by:
HELP - Need to connect to DB2 database on AIX from NT server. Also AS/400 from NT Server -- I am experienced in ORACLE and a novice at DB2. What tools would be the equivalent of Net*8 or...
1
by: Dinesh Upare | last post by:
Friends, Please provide suggestions to improve the performance of webservices? The current architecture and problems : - The webservices are installed on Server1, the database server is also on...
0
by: D.Saravanan | last post by:
I am using asp.net to connect to the DB2/400 database on the AS400. When I connect through windows forms or console application, the connection works fine. But when I connect through asp.net I get...
1
by: AJAX | last post by:
Does anyone know how or what I would use to parse or read a .AFP file? I'm developing an application for a client in VB.NET and we intend to receive an electronic feed from an insurance company. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.