473,387 Members | 1,700 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,387 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 1391

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: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.