Hey,
I'm having a bit of an issue with my code (see below). What happens is when I comment out everything below (excluding the final loop) ''Blast this to the database
The code works fine, However if I leave the code in (I need the code in as I need to send the data elsewhere) It does not appear to do anything (doesn't even write to the console)!
Any thoughts?
Thanks
JnyMris
I'm having a bit of an issue with my code (see below). What happens is when I comment out everything below (excluding the final loop) ''Blast this to the database
The code works fine, However if I leave the code in (I need the code in as I need to send the data elsewhere) It does not appear to do anything (doesn't even write to the console)!
Any thoughts?
Thanks
JnyMris
VB.NET:
Do Dim line As String = SrRead.ReadLine()
If line Is Nothing Then Exit Do
If line = "" Then Exit Do
If line.Length < 1 Then Exit Do
Console.WriteLine("-" & line & "-")
''Blast this to the Database
Dim request As WebRequest = WebRequest.Create(My.Settings.host & "insertTask")
request.Method = "POST"
Dim postData As String
postData = "computer_id=" & My.Settings.computerid & " &user_id=" & My.Settings.userid & " &log=" & line
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
request.ContentType = "application/x-www-form-urlencoded"
request.ContentLength = byteArray.Length
Dim dataStream As Stream = request.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim response As WebResponse = request.GetResponse()
dataStream = response.GetResponseStream()
Dim reader As New StreamReader(dataStream)
''End blast this to the database
Loop