J
JenHu
Hi experts,
I wrote a function which retrieves a file in the folder, the file path
is :
Dim sr As New StreamReader(strFilepath & ReturnFileName)
What if I have more than 1 file_name in EPay_Batch_Table Where
File_Status=2?
How to read multiple files and 1 file at a time, through a loop?
Thanks.
Public Function ProcessRET(ByRef strFilepath As String)
Dim EpayConnection As New SqlConnection
Dim GPConnection As New SqlConnection
Dim cmdBatchName As New SqlCommand
Dim dtrBatchName As SqlDataReader
Dim strRetFileName As String
EpayConnection.ConnectionString = strEpayDBConn
With cmdBatchName
.Connection = EpayConnection
.CommandText = "SELECT File_Name FROM EPay_Batch_Table
Where File_Status=2"
End With
EpayConnection.Open()
Try
dtrBatchName = cmdBatchName.ExecuteReader()
dtrBatchName.Read()
strRetFileName = dtrBatchName("File_Name")
Catch ex As Exception
MsgBox("All file status <> 2, No return file",
MsgBoxStyle.Information)
End Try
Dim ReturnFileName As String = strRetFileName.Replace(".in",
".RET")
EpayConnection.Close()
Dim flRetBatch As File
Dim stRetBatch As FileStream
Dim smRetBatch As StreamReader
Dim sr As New StreamReader(strFilepath & ReturnFileName)
'Open the text file into a stream reader
Try
............................
Catch
End Try
End Function
*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
I wrote a function which retrieves a file in the folder, the file path
is :
Dim sr As New StreamReader(strFilepath & ReturnFileName)
What if I have more than 1 file_name in EPay_Batch_Table Where
File_Status=2?
How to read multiple files and 1 file at a time, through a loop?
Thanks.
Public Function ProcessRET(ByRef strFilepath As String)
Dim EpayConnection As New SqlConnection
Dim GPConnection As New SqlConnection
Dim cmdBatchName As New SqlCommand
Dim dtrBatchName As SqlDataReader
Dim strRetFileName As String
EpayConnection.ConnectionString = strEpayDBConn
With cmdBatchName
.Connection = EpayConnection
.CommandText = "SELECT File_Name FROM EPay_Batch_Table
Where File_Status=2"
End With
EpayConnection.Open()
Try
dtrBatchName = cmdBatchName.ExecuteReader()
dtrBatchName.Read()
strRetFileName = dtrBatchName("File_Name")
Catch ex As Exception
MsgBox("All file status <> 2, No return file",
MsgBoxStyle.Information)
End Try
Dim ReturnFileName As String = strRetFileName.Replace(".in",
".RET")
EpayConnection.Close()
Dim flRetBatch As File
Dim stRetBatch As FileStream
Dim smRetBatch As StreamReader
Dim sr As New StreamReader(strFilepath & ReturnFileName)
'Open the text file into a stream reader
Try
............................
Catch
End Try
End Function
*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*