Public Function ExecuteNonQuery(ByVal sSQLCmd As String, _
Optional ByRef sErrMsg As String = "")
As Boolean
Try
Dim strConn As String = GetConnectionString()
Dim cConn As SqlConnection = New SqlConnection(strConn)
cConn.Open()
If cConn.State = ConnectionState.Open Then
Dim cCmd As SqlCommand = New SqlCommand(sSQLCmd, cConn)
cCmd.ExecuteNonQuery()
End If
If cConn.State = ConnectionState.Open Then cConn.Close()
Return True
Catch ex As Exception
sErrMsg = ex.Message
End Try
End Function
No comments:
Post a Comment