473,413 Members | 1,778 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,413 software developers and data experts.

Retrieving teh source of an error

Hello,

When you get an error in a VB.NET program, is it possible to know what is
the origin of the error. I assume it can be VB.NET, the framework, a
database engine, the database itself (Access, SQL Server, ...).

How can you know which source has thrown the exception?
Some error messages are in English, some in my own language.

Many thanks and greetings,

Michel
Aug 10 '07 #1
2 1112
On Aug 10, 12:16 pm, "Michel Vanderbeke" <michel.vanderb...@skynet.be>
wrote:
Hello,

When you get an error in a VB.NET program, is it possible to know what is
the origin of the error. I assume it can be VB.NET, the framework, a
database engine, the database itself (Access, SQL Server, ...).

How can you know which source has thrown the exception?
Some error messages are in English, some in my own language.

Many thanks and greetings,

Michel
Try
'// Bad code here
Catch (ex as Exception)
'// Examine the variable 'ex' here to determine the problem from
'// useful properties such as StackTrace and Message etc.
End Try

Thanks,

Seth Rowe

Aug 10 '07 #2
If you are using sql server to connect to databases, you can obtain error
messages generated by sql server in the language your user is using.
Import System.threading.thread

In the connection string add Language=MyUserLanguage wher you previously
deteremined the language the user is using as follows

MyUserLanguage = CurrentThread.currentUIculture.Tostring
Set the connection string before you fill the dataset.

In the try catch block you can use
catch ex as .......
Where you can look at the list of possible values, for instance you will see
that you can catch an odbc exception
you can have several catch statements in the same try catch block each one
directed to find a different type of exception.
Try
catch exo as Oledb.oledbexception
you get oledb error info if an oledb error occurs
CatchExs as exception
you get standard exception info
end try
Some exceptions will not return localized text, others like sql server will
if you specify the Language being used.
I would create Resource files for the errors I expect, one for each language
being used and make error messages in each language so then you can use
My.resources.thenameof the Errormessagekey and the program will pick up your
localized error messages. The standard ex.message and ex.stack trace will be
in English and should not realy be shown to the user.

You can create an exception class that shows a form with texboxes for info
on Whathappened, How it affects the User, what the user can do and
additional tech info. and if you feel it necessary you can take screen shots
and mail untrapped errors to tech support.

In Vs2005 you can use the application event on untrapped error to trap these
errors, get the info to show an error form to the user anfd then get a
screen shot, and a stack trace to send to tech support. Its not that hard to
do.

HTH
Bob

"Michel Vanderbeke" <mi***************@skynet.bewrote in message
news:46***********************@news.skynet.be...
Hello,

When you get an error in a VB.NET program, is it possible to know what is
the origin of the error. I assume it can be VB.NET, the framework, a
database engine, the database itself (Access, SQL Server, ...).

How can you know which source has thrown the exception?
Some error messages are in English, some in my own language.

Many thanks and greetings,

Michel


Aug 10 '07 #3

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

Similar topics

1
by: DS | last post by:
Hi all, Will appreciate if someone can help me with this problem. I am using VS 2003 on Win2000, sp 4. 2GB RAM. Session data is stored on DB on another machine in network. Can connect to the...
6
by: Plat | last post by:
I've Googled this for a while, to no avail. Hopefully someone can help me. Maybe I'm using the wrong terminology. Here's the scoop! Let's say I've got a simple *.ASPX page that has a syntax...
2
by: Sakke | last post by:
Hello! We have written a GCryptoSvr.dll COM server in C++. Inside that resides WebClient COM component. WebClient CLSID is {8DC27D48-F94C-434B-A509-C3E1A3E75B9E}. When we are using that...
1
by: jimmyfo | last post by:
Hi, I recently wrote an ASP.Net web application in VS2005 and published (using VS2005 Publish feature) it to a relatively clean machine with ASP.Net 2.0 and MDAC 2.8 installed on it. However, when...
6
by: yasodhai | last post by:
Hi, I used a dropdown control which is binded to a datagrid control. I passed the values to the dropdownlist from the database using a function as follows in the aspx itself. <asp:DropDownList...
5
by: Sanjay Pais | last post by:
I have a table with over 1.3 million rows. I am retrieving only 20 at a time using the with - over clauses In query analyser, the data is retrieved in under a second. When retrieving using the...
0
bmallett
by: bmallett | last post by:
First off, i would like to thank everyone for any and all help with this. That being said, I am having a problem retrieving/posting my dynamic form data. I have a form that has multiple options...
4
by: smartin | last post by:
Hi, I'm having problem retrieving data from an SQL stored procedure. I tried debugging but it wont give a the reason for the error. it just throws an exception after executing cmd.ExecuteNonQuery...
3
by: Bruno Vignola | last post by:
Good Morning all, I need to interoperate with the Calendar of MS Outlook 2003 (inserting, retrieving, listing events, etc. etc.) from an ASP.NET application; I first developed a simple windows...
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
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
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,...
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: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.