473,434 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,434 software developers and data experts.

Creating Microsoft Application Exception Classes

SS
Hi All,

I am trying to create a simple DBException Class which I want to use in
different apps.

Here is what I am doing:

1. I Created a VB Class
Imports Microsoft.ApplicationBlocks.ExceptionManagement

Imports System.Data.SqlClient

Public Class DBExceptionPublisher

Implements IExceptionPublisher

Private SQL_CONNECTION_STRING As String = _

"User Id=sqamar;" & _

"Password=password;" & _

"Server=trd-11982;" & _

"DataBase=NX20;"

Public Sub Publish(ByVal exception As System.Exception, _

ByVal additionalInfo As System.Collections.Specialized.NameValueCollection ,
_

ByVal configSettings As System.Collections.Specialized.NameValueCollection )
_

Implements
Microsoft.ApplicationBlocks.ExceptionManagement.IE xceptionPublisher.Publish

Dim strConn As String = SQL_CONNECTION_STRING

Dim scnnFTTP As New SqlConnection(strConn)

Dim scmd As New SqlCommand("spTestTable", scnnFTTP)

Try

scnnFTTP.Open()

scmd.CommandType = CommandType.StoredProcedure

With scmd.Parameters

..Add(New SqlParameter("@paramin", SqlDbType.VarChar)).Value = "Hello String"

End With

Dim myReader As SqlDataReader = scmd.ExecuteReader()

Catch expSQL As SqlException

MessageBox.Show(expSQL.Message())

End Try

End Sub

End Class

2. Created a app.config file

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<configSections>

<section name="exceptionManagement"
type="Microsoft.ApplicationBlocks.ExceptionManagem ent.ExceptionManagerSectio
nHandler,Microsoft.ApplicationBlocks.ExceptionMana gement" />

</configSections>

<exceptionManagement mode="on">

<publisher assembly="VB_App_Test" type="VB_App_Test.DBExceptionPublisher" />

</exceptionManagement>

</configuration>

3. In my VB Form I did:

Try
Dim x As Integer
Dim y As Integer

y = 0
x = 1 / y

Catch ex As Exception
ExceptionManager.Publish(ex)
End Try

This works fine but when I create another project and reference this dll it
gives me an error:

Argument not specified for parameter 'additionalInfo' of 'Public Overridable
NotOverridable Sub Publish(exception As System.Exception, additionalInfo As
System.Collections.Specialized.NameValueCollection , configSettings As
System.Collections.Specialized.NameValueCollection )'.
C:\Documents and Settings\slqamar\My Documents\Visual Studio
Projects\ExceptionManagerTestApp\Form1.vb(65): Argument not specified for
parameter 'configSettings' of 'Public Overridable NotOverridable Sub
Publish(exception As System.Exception, additionalInfo As
System.Collections.Specialized.NameValueCollection , configSettings As
System.Collections.Specialized.NameValueCollection )'.

PLease can someone tell me what I am doing wrong.

Thx

Sal


Jul 21 '05 #1
0 1395

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: DraguVaso | last post by:
Hi, In my application, on some given actions while debugging in Visual Studio, I suddenly get a "System.ComponentModel.Win32Exception was unhandled" Message="Error creating window handle."...
15
by: Carlos Lozano | last post by:
Hi, What is the right way to create an OCX COM component. The component is already registerred, but can't create an instance. I am using the reference to the interop module created. If I use...
0
by: SS | last post by:
Hi All, I am trying to create a simple DBException Class which I want to use in different apps. Here is what I am doing: 1. I Created a VB Class Imports...
12
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without...
15
by: David Thielen | last post by:
Hi; My ASP.NET app (C# calling J# under .net 2.0) creates a png file in a subdirectory to display as part of the created page. However, the bitmap will not display due to a security violation. ...
1
by: Gerhard | last post by:
How can I create a new contact in exchange server from a vb.net web application?
3
by: CharlieC | last post by:
I am writing a windows C# application, and I want to ensure that all exceptions, handled or otherwise, are logged to the local event log. I can do this for the handled exceptions, but I am not sure...
2
by: astolpho | last post by:
I am using a slightly outdated reference book on J2EE programming. It gives 2 methods of creating a database used in its casestudies. The first is an ANT script that gives the following output: ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.