Here's the code where I navigate the datagrid...
For i As Integer = 0 To dgv.Rows.Count - 1
If Not isAccountValid(dgv.Rows(i).Cells("Cable Account")) Then
dgvCell = dgv.Rows(i).Cells("Cable Account")
'cableAccountCell.Style.BackColor = Color.Red
dgvCell.ErrorText = "Invalid Account Number"
Else 'populate the extra columns with the values needed for the macro
populateRow(dgv.Rows(i))
End If
Next
Here's the code inside the isAccountValid function
Dim retVal As Boolean
Dim accountNumber As Integer
Try
accountNumber = CInt(accountCell.Value)
If accountNumber > 999999999 Then
retVal = False
Return retVal
End If
Catch ex As Exception
retVal = False
Return retVal
End Try
Dim sql As String = "call " & spLibrary & ".sp_chkacct(@siteID, @acctNumber)"
Dim cmd As New iDB2Command(sql, cn)
cmd.Parameters.Add("@siteID", iDB2DbType.iDB2Decimal, 3)
cmd.Parameters("@siteID").Scale = 0
cmd.Parameters("@siteID").Value = 2
cmd.Parameters.Add("@acctNumber", iDB2DbType.iDB2Decimal, 9)
cmd.Parameters("@acctNumber").Scale = 0
cmd.Parameters("@acctNumber").Value = accountNumber
Dim dr As iDB2DataReader
dr = cmd.ExecuteReader()
retVal = dr.Read()
dr.Close()
Return retVal
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
P Go Green! Print this email only when necessary. Thank you for helping Time Warner Cable be environmentally responsible.
-----Original Message-----
From: systemidotnet-bounces@xxxxxxxxxxxx [mailto:systemidotnet-bounces@xxxxxxxxxxxx] On Behalf Of ibm
Sent: Tuesday, May 26, 2009 10:04 AM
To: .net use with the System i
Subject: Re: [SystemiDotNet] Validating data...
Can you post the code?
-----Original Message-----
From: systemidotnet-bounces@xxxxxxxxxxxx [mailto:systemidotnet-bounces@xxxxxxxxxxxx] On Behalf Of Mira, Antonio
Sent: Wednesday, May 13, 2009 3:01 PM
To: .net use with the System i
Subject: Re: [SystemiDotNet] Validating data...
There will be an average of 150 to 200 customer numbers to validate. It takes a good 15 to 20 seconds. I do have some simple validation that I do before I validate against the iSeries (sometimes I get account numbers that are longer than 9 digits, so I don't even go to the iSeries to validate). When I hit those, it goes really fast but when I the process goes to the iSeries, that's when it slows down.
I was just thinking of reducing that time.
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
-----Original Message-----
From: systemidotnet-bounces@xxxxxxxxxxxx [mailto:systemidotnet-bounces@xxxxxxxxxxxx] On Behalf Of Walden H. Leverich
Sent: Wednesday, May 13, 2009 3:33 PM
To: .net use with the System i
Subject: Re: [SystemiDotNet] Validating data...
BTW, what's "sort of slow"? 1 second? 5? 50? 500? And how many customers in the excel sheet?
-Walden
As an Amazon Associate we earn from qualifying purchases.