I am returning a recordset from SQL Stored Proc and writing them to a text file. All of the records are not getting written to the text file. Earlier I got 350 out of 386 and now I am getting 335 out of 386. It is almost as if the connection or session with the sql server is closing before I can write all of the records to the text file.
Can some one help? Below is the code I am using for my SQLReader:
Try
Me.Cursor = Cursors.WaitCursor
With SQLCmd
.CommandText = "ESH_AP_LoadPOSPay_sp"
.CommandType = CommandType.StoredProcedure
.Connection = SQLCon
.Parameters.AddWithValue("@dbname", sDBName)
End With
SQLReader = SQLCmd.ExecuteReader()
If SQLReader.HasRows = True Then
Do While (SQLReader.Read)
oWrite.WriteLine(SQLReader.Item(0) & " " & SQLReader.Item(1))
SQLReader.NextResult()
Loop
Else
End If
objPlsWait.CloseWaitScreen()
objPlsWait = Nothing
Me.Show()
Catch sqlex As SqlException
ShowError("A SQL error has ocurred. -- " & sqlex.Message & vbCrLf)
End Try
Thanks for any and all help.
SimpleMusings
Can some one help? Below is the code I am using for my SQLReader:
Try
Me.Cursor = Cursors.WaitCursor
With SQLCmd
.CommandText = "ESH_AP_LoadPOSPay_sp"
.CommandType = CommandType.StoredProcedure
.Connection = SQLCon
.Parameters.AddWithValue("@dbname", sDBName)
End With
SQLReader = SQLCmd.ExecuteReader()
If SQLReader.HasRows = True Then
Do While (SQLReader.Read)
oWrite.WriteLine(SQLReader.Item(0) & " " & SQLReader.Item(1))
SQLReader.NextResult()
Loop
Else
End If
objPlsWait.CloseWaitScreen()
objPlsWait = Nothing
Me.Show()
Catch sqlex As SqlException
ShowError("A SQL error has ocurred. -- " & sqlex.Message & vbCrLf)
End Try
Thanks for any and all help.
SimpleMusings