Dot Net Fluke: Getting by on C# for iSeries RPG Developers

Useful tutorials on C# and .NET for RPG iSeries AS/400 developers. Brought to you from the folks at AranRock Consulting

3/18/08

C# Subfile - iSeries data in a C# Grid -2 no coding (with Video)

Well almost no coding.

If you look at my previous post where I showed how to code a grid in C# using data from the iSeries we manually coded the grid, the data set and the connection. This example accomplishes the same result except you'll be done in under 5 minutes!  It uses the IDE to build the grid, data set, adapter, connection and SQL command.

The video also shows how to add in the iSeries .net data components to your Visual Studio toolbox.
This post easier shown than discussed - so check out the following video.
play

Steps

  1. Create a windows form application project
  2. Add in the IBM dll to your references
  3. Add in the IBM data tools to your toolbox using Tools, Choose Toolbox items and filter 'idb2'
  4. Add a basic grid to your form
  5. Drag the iDB2Connection, IDB2Command, iDB2DataAdapter and a data set to your form
  6. Configure each by right clicking and selecting properties
  7. Double click outside the grid to bring up the code for the Load method of the form.
  8. Add in the following code
    iDB2DataAdapter1.Fill(dataSet1);
    dataGrid1.DataMember = dataSet1.Tables[0].TableName;
  9. Run the program!

Labels: , , , , , ,

4 Comments:

At April 24, 2008 at 7:44 AM , Anonymous Anonymous said...

I downloaded your code and works great. I added in a search feature as well. Saved me a bunch of time.

 
At April 24, 2008 at 9:29 AM , Anonymous Anonymous said...

Is this update as well? How do you add CRUD controls?

 
At May 1, 2008 at 1:48 PM , Anonymous Anonymous said...

Great tutorial! I'm just scratching the surface on C# / iSeries so this was nice 'n easy.

 
At May 5, 2008 at 8:09 PM , Anonymous Anonymous said...

I am using visual web developer 2005 express edition. I added reference to IDB2 data provider and selected IDB2Command tool box item from .net framework components. Why the IDB2Command item is grey out (invisible) in the tool box? How to display iseries data using web control datagrid?

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home