473,569 Members | 2,542 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1119
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.threadin g.thread

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

MyUserLanguage = CurrentThread.c urrentUIculture .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.oledbexce ption
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.th enameof 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.bewr ote 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
1786
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 DB (no problem with that). I try to save DB connection string in web.config file, as described in MSDN 'Declaring and Accessing Section Groups'...
6
2875
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 error. For example, broken.aspx might only contain the following line of code: <% Dim x as %> When I visit this page from my Web browser, I see all...
2
15693
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 WebClient COM component from C++ code it works just fine. However when we try to use that same WebClient in the same machine with following C# code: ...
1
9437
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 I try to create my SQL connection in the code-behind, I get the following error. I tried to register the DLL using regsvr32 but that errored out...
6
5839
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 ID="FldType_add" Runat="server" DataSource='< %#GetFieldType()%>' DataValueField="Type" DataTextField="Type" /> Oce the page is loaded all the...
5
1966
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 data adaptor.fill or datareader to retrieve the data it takes over 24 seconds. public System.Data.SqlClient.SqlDataReader List1(int PageIndex, int...
0
3373
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 within options. I have everything being dynamically named from the previously dynamically named element. (I hope this makes sense.) I am not able to...
4
18800
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 without any details. Can anyone please help me.. Im stuck on it since 2 days Thanks Stored Procedure
3
2165
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 application in C# and it worked fine, I added the OL reference and created the COM object with the following code:
0
7700
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7614
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8125
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7974
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3653
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.