Heres the current code base:
<code>
Public Function DBQuery(ByVal strCmdType As String, ByVal strSQL As String,
ByVal strWhoCalledMe As String, Optional ByVal strCstr_ToUse As String =
"None Given") As String
Dim strWhoAmI As String = My.Application.Info.Title &
".clsCommonTools.DBQuery"
Dim strAnswer As String = "False"
Dim strSQLCmdWas As String = strSQL
Dim strResult As String = ""
Dim Connection As New SqlConnection
'#### Execute Query ####
Try
' MessageBox.Show("Here I am!", "just entered DbQuery",
MessageBoxButtons.OK, MessageBoxIcon.Error)
If (strCstr_ToUse <> "None Given") Then
Connection.ConnectionString = strCstr_ToUse
Else
Connection.ConnectionString =
My.Forms.USAGoldCorp.msConnectionStrToUse
End If
' MessageBox.Show("Here I am!", "Cstr Set",
MessageBoxButtons.OK, MessageBoxIcon.Error)
' MessageBox.Show(Connection.ConnectionString.ToString, "Cstr
Is", MessageBoxButtons.OK, MessageBoxIcon.Error)
Connection.Open()
' MessageBox.Show("Here I am!", "Connection opened",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Dim cmdRequest As New SqlCommand
With cmdRequest
.CommandText = strSQL
.CommandType = Data.CommandType.Text
.Connection = Connection
.CommandTimeout = 60000 '3400000
End With
' MessageBox.Show("Here I am!", "set Request Obj",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Select Case strCmdType
Case "CMD"
cmdRequest.ExecuteNonQuery()
strResult = "True"
Case "QUERY"
strResult = ""
strResult = cmdRequest.ExecuteScalar()
If (strResult = Nothing) Then
With Connection
.Close()
.Dispose()
End With
Else
strResult = "True"
End If
Case "RESULT"
strResult = ""
' MessageBox.Show("Here I am!", "About to
execute SQL", MessageBoxButtons.OK, MessageBoxIcon.Error)
strResult = cmdRequest.ExecuteScalar()
' MessageBox.Show("Here I am!", "done Execution
SQL", MessageBoxButtons.OK, MessageBoxIcon.Error)
If (strResult = Nothing) Then
strResult = "False"
Else
End If
End Select
Non_error1:
strAnswer = strResult
Catch ex As Exception
MessageBox.Show(ex.Message, "Db connection Error",
MessageBoxButtons.OK, MessageBoxIcon.Error)
strResult = "False"
RecordErrorMsg(ex.Message, My.Application.Info.Title,
My.Application.Info.Version.ToString, strWhoAmI, strWhoCalledMe, ("CMD Type
was: " & strCmdType & Environment.NewLine), strSQL,
My.Forms.USAGoldCorp.msUserID)
End Try
With Connection
If (Connection.State = Data.ConnectionState.Open) Then
.Close()
End If
.Dispose()
End With
DBQuery = strAnswer
' MessageBox.Show("Here I am!", "Leaving DbQuery",
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Function
</code>
--
Deasun
Home Site:
www.tirnaog.com
Check out: The Code Vault in my forums section.
Patrice said:
Also make sure you don't hide the exception rather than revealing it. An
agressive firewall perhaps ?
Seeing some code could also help to understand if it is a coding issue (just
the minimal amount of lines needed to repro the issue).