× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



UPDATE: I now have both my client and the i5 running on the same release
level of V5R3. I am just attempting to use the IBM DB2 .Net provider to
load a DataGridView. I keep getting this error:

The following exception occurred in the DataGridView:

System.ArugumentException: Parameter is not valid. at
... at ... at ... at
System.Windows.Forms.DataGridViewCell.GetFormattedValue(Object value,
Int32 rowIndex, DataGridViewCellStyle& cellStyle, TypeConverter
valueTypeConverter, TypeConverter formattedValueTypeConverter,
DataGridViewDataErrorContexts context)



Here's a snippet of my code:

Private Sub Do_Query()
Dim oDS As New DataSet()

oDS = CreateDataSet("Select * from DATALIB.F41021", oDS,
"Input")

DataGridView1.DataSource = oDS
DataGridView1.DataMember = "Input"
End Sub

Private Function CreateDataSet(ByVal strSQL As String, ByVal
oDataSet As DataSet, ByVal strTableName As String) As DataSet
Dim connDB As New iDB2Connection()
Dim cmdDB As New iDB2Command()
Dim oDataAdapter As New iDB2DataAdapter()

connDB.ConnectionString = "DataSource=1.1.1.1"
connDB.Open()
cmdDB.Connection = connDB
oDataAdapter.SelectCommand = cmdDB
cmdDB.CommandText = strSQL
oDataAdapter.Fill(oDataSet, strTableName)

oDataAdapter = Nothing
cmdDB = Nothing
connDB.Close()

Return oDataSet
End Function


This seems pretty simple and straightforward. I'm sure several others
are doing the exact same thing. Has anyone else seen this error?

Thanks
Bob Cagle



-----Original Message-----
From: systemidotnet-bounces@xxxxxxxxxxxx
[mailto:systemidotnet-bounces@xxxxxxxxxxxx] On Behalf Of Bob Cagle
Sent: Friday, May 02, 2008 3:08 PM
To: .net use with the System i
Subject: Re: [SystemiDotNet] DataGridView field error

I tried changing my Select statement to include CHAR() around the field
in question, but that didn't work, or I got the syntax wrong, because
then I got the Object Reference Not Set error when I attempted to
reference the field - so the field was never defined.

I have also since discovered that the problem is not limited to this one
field. I have tested several different files, and I seem to get the
same error on most alpha fields, but not all.

I am thinking now that it is an incompatibility between my client and
the i5 - I am running the V5R4 version of iSeries Access, and thus the
DB2 .Net data provider, but my i5 is still at V5R3 for the time being.

I'll do my best to get the upgrade scheduled and completed so that I can
test that theory.

-----Original Message-----
From: systemidotnet-bounces@xxxxxxxxxxxx
[mailto:systemidotnet-bounces@xxxxxxxxxxxx] On Behalf Of Elvis Budimlic
Sent: Thursday, May 01, 2008 11:46 AM
To: '.net use with the System i'
Subject: Re: [SystemiDotNet] DataGridView field error

What you deduced makes sense. One thing that's not clear is if you've
hardcoded the columns being returned or just let the DataGridView
dynamically create them (usual case). If you've hardcoded the columns,
you
ought to be able to change them then.

If it is dynamic and it's the issue with the DataGridView
misinterpreting
the data type (shouldn't do that, but...), perhaps you can change your
SQL
SELECT statement to explicitly cast that column to character (i.e.
CHAR(myColumn)).

I wish I knew more about .net to give you some .net type options but I'm
still learning as well.

HTH, Elvis

Celebrating 11-Years of SQL Performance Excellence on IBM i, i5/OS and
OS/400
www.centerfieldtechnology.com

-----Original Message-----
Subject: [SystemiDotNet] DataGridView field error

I have a small test app that I've been playing with, learning how to
connect and pull data from my i5. Good news is I got it working
perfectly. Bad news is I changed the input file and now it's not
working.

The file that I have changed to is a JD Edwards file that has the
Business Unit field in it. This is a very common field in JDE, and a
little strange. It's a 12 digit character field, but almost always has
a right-justified numeric value in it.

I am including this field in my grid, along with the Item number and
Quantity on hand. When the grid loads, I see a red 'X' for the Business
Unit and I get the following error:

System.Windows.Forms.DataGridViewCell.GetFormattedValue(Object value,
Int32 rowIndex, DataGridViewCellStyle& cellStyle, TypeConverter
valueTypeConverter, TypeConverter formattedValueTypeConverter,
DataGridViewDataErrorContexts context)

I have no idea what this means, but I assume it means that VB is
assuming that this field is numeric, but then crashing when it finds
there is non-numeric data in the field (blanks). The other two fields
show up fine.

How do I resolve this error? Is there a specific property I need to set
on the column to force a character data type?

Thanks

Bob Cagle

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.