D
douglas
In the following logic, I code in the loop for with the following code to
execute one more time. The code I am referring is the following:
For A = 0 To ds.Tables(0).Rows.Count - 1
(I would like this code to say or A=max values in dataset.) Thus can you
tell me
what you would do to add this kind of logic)
The outside loop is for the number of rows sel4ected in a dataset that
contains all the data that will be displayed in an excel spreadsheet in the
inner loop.
Dim A As Integer
Dim strZipFileName, strHldHNumber As String
Dim strTemp, strTemp2, strTemp3, x, y, z, strhnumber, strZipFile As String
Dim connetionString As String =
ConfigurationManager.AppSettings.Get("sqlconnect")
im di As New
IO.DirectoryInfo(ConfigurationManager.AppSettings.Get("excel_location"))
Dim aryFi As IO.FileInfo() = di.GetFiles("*.xls")
Dim intCntr As Integer
sqlCnn = New SqlConnection(connectionString)
Dim da As New SqlDataAdapter
Dim ds As New DataSet()
da = New SqlDataAdapter(sqlCmd)
sqlCmd.Connection = New SqlConnection(connectionString)
Try
sqlCnn.Open()
da = New SqlDataAdapter(sqlCmd)
sqlCmd.CommandText =
ConfigurationManager.AppSettings.Get("CommandText")
sqlCmd.CommandType = CommandType.StoredProcedure
da.Fill(ds)
sqlCmd.Dispose()
sqlCnn.Close()
'Initialize our variables
'Check to make sure the directory has at least one record and
the pattern for the reports are named corrected
strHldHNumber =
UCase(Trim(CStr((ds.Tables(0).Rows(0).Item(0))))) ' Position 0
strTemp = ""
strTemp2 = ""
strTemp3 = ""
strZip = ""
strZip2 = ""
strZip3 = ""
strhnumber = ""
Dim IntTotalRows As Integer = ds.Tables(0).Rows.Count
Dim intFileRows As Integer = UBound(aryFi)
For A = 0 To ds.Tables(0).Rows.Count - 1
For intCntr = 0 To UBound(aryFi) Step 1
If Trim(strHldHNumber) = UCase(Mid(aryFi(intCntr).Name,
12, 5)) Then 'hnumber
If (Mid(aryFi(intCntr).Name, 18, 4) = "xxxx") Or
(Mid(aryFi(intCntr).Name, 18, 4) = "XXXX") then
'do something1
Next intCntr
''do something2
next
execute one more time. The code I am referring is the following:
For A = 0 To ds.Tables(0).Rows.Count - 1
(I would like this code to say or A=max values in dataset.) Thus can you
tell me
what you would do to add this kind of logic)
The outside loop is for the number of rows sel4ected in a dataset that
contains all the data that will be displayed in an excel spreadsheet in the
inner loop.
Dim A As Integer
Dim strZipFileName, strHldHNumber As String
Dim strTemp, strTemp2, strTemp3, x, y, z, strhnumber, strZipFile As String
Dim connetionString As String =
ConfigurationManager.AppSettings.Get("sqlconnect")
im di As New
IO.DirectoryInfo(ConfigurationManager.AppSettings.Get("excel_location"))
Dim aryFi As IO.FileInfo() = di.GetFiles("*.xls")
Dim intCntr As Integer
sqlCnn = New SqlConnection(connectionString)
Dim da As New SqlDataAdapter
Dim ds As New DataSet()
da = New SqlDataAdapter(sqlCmd)
sqlCmd.Connection = New SqlConnection(connectionString)
Try
sqlCnn.Open()
da = New SqlDataAdapter(sqlCmd)
sqlCmd.CommandText =
ConfigurationManager.AppSettings.Get("CommandText")
sqlCmd.CommandType = CommandType.StoredProcedure
da.Fill(ds)
sqlCmd.Dispose()
sqlCnn.Close()
'Initialize our variables
'Check to make sure the directory has at least one record and
the pattern for the reports are named corrected
strHldHNumber =
UCase(Trim(CStr((ds.Tables(0).Rows(0).Item(0))))) ' Position 0
strTemp = ""
strTemp2 = ""
strTemp3 = ""
strZip = ""
strZip2 = ""
strZip3 = ""
strhnumber = ""
Dim IntTotalRows As Integer = ds.Tables(0).Rows.Count
Dim intFileRows As Integer = UBound(aryFi)
For A = 0 To ds.Tables(0).Rows.Count - 1
For intCntr = 0 To UBound(aryFi) Step 1
If Trim(strHldHNumber) = UCase(Mid(aryFi(intCntr).Name,
12, 5)) Then 'hnumber
If (Mid(aryFi(intCntr).Name, 18, 4) = "xxxx") Or
(Mid(aryFi(intCntr).Name, 18, 4) = "XXXX") then
'do something1
Next intCntr
''do something2
next