Click here to Skip to main content
15,892,697 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: VBS for next loop Pin
Richard MacCutchan19-Feb-16 0:45
mveRichard MacCutchan19-Feb-16 0:45 
GeneralRe: VBS for next loop Pin
Member 1191673519-Feb-16 0:51
Member 1191673519-Feb-16 0:51 
GeneralRe: VBS for next loop Pin
Richard MacCutchan19-Feb-16 0:56
mveRichard MacCutchan19-Feb-16 0:56 
GeneralRe: VBS for next loop Pin
Member 1191673519-Feb-16 1:02
Member 1191673519-Feb-16 1:02 
GeneralRe: VBS for next loop Pin
Richard MacCutchan19-Feb-16 2:25
mveRichard MacCutchan19-Feb-16 2:25 
AnswerRe: VBS for next loop Pin
Eddy Vluggen19-Feb-16 1:55
professionalEddy Vluggen19-Feb-16 1:55 
GeneralRe: VBS for next loop Pin
CHill6019-Feb-16 2:06
mveCHill6019-Feb-16 2:06 
QuestionSQL Server Connection error not caught by error handling. Pin
Christopher Kettlewell18-Feb-16 11:19
Christopher Kettlewell18-Feb-16 11:19 
I have a program that has an associated SQL Server database, running in SQL Server Express 2014 all running on a virtual Windows 2008 server. The program has masses of different calls to the database to select, insert and update data through all sorts of different parts of the program. It has background workers threads running multi threading and it's all working beautifully.

But I have a procedure that's not a background thread that also has various calls to the SQL Server database and I'm finding that at around 1:50am every day this process is stopping (the background threads continue to function perfectly, it doesn't stop them) and when I log into the server there is a pop up box saying there was an issue connecting to the server. It's had a few different errors, a common one being "...an error occurred during the pre-login handshake". Click okay on the box and it gets back to processing as normal.

It's not the error that concerns me, it's the fact that nothing I do seems to catch the error and stop it popping up the error box. Nowhere else in the program is this a problem, everywhere else handles the errors fine and the code here is exactly the same as everywhere else. I have searched everywhere and can't find any posts with a similar error, so I'm posting my own.

Here is my code:
VB
Try
  Using conn = New SqlConnection(Gdetails.sConnectionString)
    conn.Open()
    Dim data As SqlDataReader
    Dim adapter As New SqlDataAdapter
    Dim command As New SqlCommand
    command.CommandText = query
    command.Connection = conn
    adapter.SelectCommand = command
    data = command.ExecuteReader()
    While data.Read
       If data.HasRows = True Then
           'Do Heaps of stuff
           '...
       End If
    End While
  End Using
Catch ex As Exception
   Write_To_Event_Log(Environment.MachineName & " thread monitor error - " & " - " & ex.Message.ToString, EventLogEntryType.Error, 205)
End Try

I would think the try..catch should catch the SQL connection error and simply write the error to the event log. But it's not catching the error, it's popping up a message which might be okay for a user based system but is no good for something that's designed to just keep processing without user intervention.

It's like the SQL connection isn't treating this as an error, it's just popping up a messagebox of it's own, rather than actually raising an error that can get caught by the try..catch code, but I can't find anyway to tell it not to do that.

Help please!
AnswerRe: SQL Server Connection error not caught by error handling. Pin
Richard Deeming19-Feb-16 1:22
mveRichard Deeming19-Feb-16 1:22 
GeneralRe: SQL Server Connection error not caught by error handling. Pin
Christopher Kettlewell21-Feb-16 12:19
Christopher Kettlewell21-Feb-16 12:19 
GeneralRe: SQL Server Connection error not caught by error handling. Pin
Richard Andrew x6421-Feb-16 12:53
professionalRichard Andrew x6421-Feb-16 12:53 
GeneralRe: SQL Server Connection error not caught by error handling. Pin
Christopher Kettlewell10-Mar-16 10:18
Christopher Kettlewell10-Mar-16 10:18 
QuestionExecute SQL Script using Batch Pin
DotNetNarayanan17-Feb-16 20:33
DotNetNarayanan17-Feb-16 20:33 
AnswerRe: Execute SQL Script using Batch Pin
Chris Quinn17-Feb-16 21:35
Chris Quinn17-Feb-16 21:35 
QuestionREG: COM Component in VB.Net Pin
manowj17-Feb-16 3:54
manowj17-Feb-16 3:54 
QuestionVBs How can I Show a InputBox on a Client Computer? Pin
Member 1191673517-Feb-16 1:23
Member 1191673517-Feb-16 1:23 
AnswerRe: VBs How can I Show a InputBox on a Client Computer? Pin
Dave Kreskowiak17-Feb-16 2:35
mveDave Kreskowiak17-Feb-16 2:35 
AnswerRe: VBs How can I Show a InputBox on a Client Computer? Pin
ZurdoDev17-Feb-16 3:09
professionalZurdoDev17-Feb-16 3:09 
QuestionHow to remove duplicate in combobox Pin
Fathur Rozi11-Feb-16 18:38
Fathur Rozi11-Feb-16 18:38 
AnswerRe: How to remove duplicate in combobox Pin
Richard MacCutchan11-Feb-16 21:13
mveRichard MacCutchan11-Feb-16 21:13 
GeneralRe: How to remove duplicate in combobox Pin
Fathur Rozi12-Feb-16 0:56
Fathur Rozi12-Feb-16 0:56 
QuestionVB.Net String Format Pin
Member 160021010-Feb-16 1:49
Member 160021010-Feb-16 1:49 
AnswerRe: VB.Net String Format Pin
Richard MacCutchan10-Feb-16 2:00
mveRichard MacCutchan10-Feb-16 2:00 
QuestionERRor Message Pin
Reginald_110-Feb-16 0:56
Reginald_110-Feb-16 0:56 
AnswerRe: ERRor Message Pin
Eddy Vluggen10-Feb-16 3:02
professionalEddy Vluggen10-Feb-16 3:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.