Hi All!
The following code is not writing to the text file and I was wondering if any one could tell me what I have done wrong. If I take the Do Until Loop off it will write the first line to the file, so I believe the problem is in the Loop.
The following code is not writing to the text file and I was wondering if any one could tell me what I have done wrong. If I take the Do Until Loop off it will write the first line to the file, so I believe the problem is in the Loop.
VB.NET:
'Verify that all ecodes are in cross reference table
Dim DB As ADODB.Connection
Dim rs As ADODB.Recordset
DB = New ADODB.Connection
DB.Open('left blank here for security reasons')
sSQL = "SELECT * FROM twgi_pay_accrual "
sSQL += "WHERE NOT EXISTS(SELECT * FROM twgi_pay_crsref "
sSQL += "WHERE ecode = ecode_accr)"
rs = DB.Execute(sSQL)
If Not rs.EOF Then
Dim stext As String = "C:\payaccrual_code_" & jedate.Substring(0, 2) & jedate.Substring(6) & ".txt"
Dim f As System.IO.StreamWriter = System.IO.File.CreateText(stext)
Do Until rs.EOF
f.WriteLine(rs(1).Value)
rs.MoveNext()
Loop
MsgBox("Need to add new etime code to crossreference table" & vbCrLf & "New codes located at " & stext)
f.Close()
f = Nothing
DB.Close()
DB = Nothing
Exit Sub
End If