Hello,

I tried your suggestion and I must be doing something wrong because the page is failing at the connection string with the following error:

The connection property is invalid.

I did notice that you have the connection parameters in the gridview itself. I am setting all the connection properties in code as you can see in my code here:

Protected Sub btnGo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGo.Click

Dim reportSelected As Integer = rblReportSelection.SelectedIndex
Select Case reportSelected
Case 0 'Trouble Calls with no Drop Bury
generateReport("WONODROP", rblReportSelection.SelectedValue)
Case 1 'JZ Work orders with no scheduled Drop Bury
generateReport("WOJZNODROP", rblReportSelection.SelectedValue)
End Select


End Sub


Private Sub generateReport(ByVal tableName As String, ByVal gridCaption As String)
Dim connection As New iDB2Connection()
connection.ConnectionString = "Data Source = PRVPAS2C; CharBitDataAsString=True;CharBitDataCcsid=1"
Try
connection.Open()
Catch ex As iDB2CommErrorException
Label2.Text = "Connection to iSeries failed!!!"
Label2.BackColor = Drawing.Color.Red
Exit Sub
Catch ex As iDB2ConnectionFailedException
Label2.Text = "Connection to iSeries failed!!!"
Label2.BackColor = Drawing.Color.Red
Exit Sub
End Try

Label2.Text = "Connection to iSeries was a success!!!"
Label2.BackColor = Drawing.Color.White


'populate the datagrid with house data
Dim cmd As iDB2Command = connection.CreateCommand()
cmd.CommandType = Data.CommandType.Text
cmd.CommandText = "select * from COHAMIRA." & tableName


Dim rdr As iDB2DataReader = cmd.ExecuteReader()
Dim woNoDrops As New DataTable()
woNoDrops.Load(rdr, LoadOption.Upsert)
connection.Close()

'Add the column headers
woNoDrops.Columns(0).ColumnName = "Site ID"
woNoDrops.Columns(1).ColumnName = "Work Order Number"
woNoDrops.Columns(2).ColumnName = "Account Number"
woNoDrops.Columns(3).ColumnName = "Address Line 1"
woNoDrops.Columns(4).ColumnName = "Address Line 2"
woNoDrops.Columns(5).ColumnName = "Address Line 3"
woNoDrops.Columns(6).ColumnName = "Address Line 4"
woNoDrops.Columns(7).ColumnName = "Pool"
woNoDrops.Columns(8).ColumnName = "Tech Number"
woNoDrops.Columns(9).ColumnName = "Tech Name"
woNoDrops.Columns(10).ColumnName = "Work Order Status"
woNoDrops.Columns(11).ColumnName = "Install Completion Date"

GridView1.DataSource = woNoDrops
GridView1.DataBind()
GridView1.Caption = gridCaption
GridView1.CaptionAlign = TableCaptionAlign.Left
End Sub

Thank you,
 
Antonio Mira
Application Developer - Mid-Ohio Division
Time Warner Cable
1015 Olentangy River Road - 2nd Floor
Columbus, OH 43212
http://www.timewarnercable.com
phone: 614 827 7949 
cell: 614 365 0489
 

-----Original Message-----
From: systemidotnet-bounces@xxxxxxxxxxxx [mailto:systemidotnet-bounces@xxxxxxxxxxxx] On Behalf Of ibm
Sent: Monday, February 15, 2010 4:45 PM
To: .net use with the System i
Subject: Re: [SystemiDotNet] Gridview and iSeries question...

Hmm. I got mine working ok. Can you post some code?

1. Inside VS I set up a Data Connection to iSeries using the "IBM DB2
for i5/OS" Data Source/provider.
2. Set the "CharBitDataAsString" to true, set the "CharBitDataCCSID" to
1.
3.

<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ORDNO"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="ORDNO" HeaderText="ORDNO"
ReadOnly="True"
SortExpression="ORDNO" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="DataSource=myAS400;UserID=chris;DefaultCollection=amfl
ib;LibraryList=amflib;CharBitDataAsString=True;CharBitDataCcsid=1"
ProviderName="IBM.Data.DB2.iSeries" SelectCommand="SELECT ORDNO FROM
MOMAST">
</asp:SqlDataSource>



Ref: http://www.itjungle.com/fhg/fhg071509-story01.html

-----Original Message-----
From: systemidotnet-bounces@xxxxxxxxxxxx
[mailto:systemidotnet-bounces@xxxxxxxxxxxx] On Behalf Of Mira, Antonio
Sent: Monday, February 15, 2010 12:41 PM
To: 'systemidotnet@xxxxxxxxxxxx'
Subject: [SystemiDotNet] Gridview and iSeries question...

Hello,

I'm working on a simple web app where the user selects a choice by
clicking on a radio button. Depending on the selection, I fill a
gridview. For some reason, the gridview does not behave as expected
(paging doesn't work, sorting doesn't work). I am using the .net Data
Provider. However, when I use an ODBC driver to connect to the iSeries,
the gridview works perfectly. Has anyone run into this problem? If so,
how did you resolve it?

Thanks for any help that you can provide.

Thank you,

Antonio Mira
Application Developer - Mid-Ohio Division
Time Warner Cable
1015 Olentangy River Road - 2nd Floor
Columbus, OH 43212
http://www.timewarnercable.com
phone: 614 827 7949
cell: 614 365 0489


This E-mail and any of its attachments may contain Time Warner
Cable proprietary information, which is privileged, confidential,
or subject to copyright belonging to Time Warner Cable. This E-mail
is intended solely for the use of the individual or entity to which
it is addressed. If you are not the intended recipient of this
E-mail, you are hereby notified that any dissemination,
distribution, copying, or action taken in relation to the contents
of and attachments to this E-mail is strictly prohibited and may be
unlawful. If you have received this E-mail in error, please notify
the sender immediately and permanently delete the original and any
copy of this E-mail and any printout.

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-2021 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.