Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

looking for working example of connection string -vb.net to pf

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • looking for working example of connection string -vb.net to pf

    Let me know if you get a response. I'm looking for this as well. Have you tried the ones listed at www.connectionstrings.com for the AS400?

  • #2
    looking for working example of connection string -vb.net to pf

    I am attaching a very simple example that uses the iSeries .Net Data Provider (that's what I use). You need to add a reference to "IBM DB2 UDB for iSeries .Net Provider" and then import that to your class in VB.Net (See example code attached). The example is a class for a very simple web page that has just one label and one button. When the button is clicked, the program reads all records from the file using SQL and returns a DataReader object. It then iterates through the DataReader counting the number of records returned. The number of records value is then placed in the label... Very simple. My recommendation is that once you get familiar with how to connect to the iSeries, you start using Stored Procedures rather than hard coded SQL statements to retrieve the data...

    Example.txt

    Comment


    • #3
      looking for working example of connection string -vb.net to pf

      Trying to connect to the iSeries V5R3 with .Net and having issues at the OPEN statement, I'm looking for any working examples of .Net to a PF on an iSeries. Our iSeries is V5R3, and using VB.NET Professional on an XP Pro machine. From other examples, I've used the following without any success: Examples would be appreciated! Diane
      Code

      Comment


      • #4
        looking for working example of connection string -vb.net to pf

        Running V5R3, I use this string in a production application......so I know it works: Provider=IBMDA400;Data source=MyI5;User Id=testid;Password=realpassword The provider is ISeries Access for Windows ODBC provider. Data source can also use IP Address.......you may want to try that also. I am running XP and .net 1.1 framework Be sure to check your sql statement syntax using ISeries navigator or strsql command......If the SQL syntax associated with the connection is incorrect, you will get an error (since you are opening the connection and executing the sql command at the same time)......note if you are using the "system" sql option, you will have to use file referencing in this way for you sql statement: "SELECT * FROM tstlib/testp WHERE (testcode)='" & testdonor & "'". You may already know this (depending on the amount of experience you have had with ASP.NET), but I know I really struggled with these "minor" details when I started with ASP.NET accessing our AS400. And these "minor" details can cause hours of head scratching and frustration. One more suggestion........use a try catch block to open the As400 connection first. Then create and execute the command object using a nested try catch. This way you can throw an error if the connection is failing or if the SQL statement is failing. I do have some sample code I can provide with the nested try catch statements if you would like.......just let me know if your interested. I hope this helps! Scott

        Comment

        Working...
        X