473,396 Members | 1,832 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,396 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 1394

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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.