The release number of this article has been CHS308650
For Microsoft Visual Basic .NET versions of this article, see
308043.
For Microsoft Visual C .NET versions of this article, see
308651.
This article references the following Microsoft .NET Framework Class Bank Name Space:
System.Data.Oledb
This task content
summary
Troubleshooting steps to get the infrastructure error
Summary The hosting provider may generate several exceptions. If you want to get more detailed information about it, you need to access specific error messages for the provider.
Back to top
Require the following list lists the recommended hardware, software, network structure, and service pack required:
Microsoft .NET Framework Microsoft Visual C # .net This article assumes that you are familiar with the following topics:
Abnormal Microsoft OLE DB error handling
Back to top
Getting Basic Provider Errors To get more details about exception generation, package your code in a try-catch block, capture exception, and process from
OLEDBEXCEPTION class
Errors collection.
Open a new Visual C # .NET Windows application project. Open the code of Form1.cs, copy the following code and paste to the starting position of the form: use system.data.oledb; copy the following code to Form1 Load Event: {
OLEDBCONNECTION CN
= New OLEDBCONNECTION ("provider = sqloledb.1; data source = myWrongServerName");
Try
{
Cn.open ();
}
Catch (OLEDBEXCEPTION EX)
{
For (int i = 0; i { Messagebox.show ("INDEX #" i.toString () "/ n" "Message:" EX.Errors [i] .Message "/ N" "Native:" EX.Errors [i] .nativeError.Tostring () "/ n" "Source:" EX.Errors [i]. Source "/ N" "SQL:" EX.Errors [i] .sqlState "/ n"); } } } Run the app. A message box should appear after 10 to 15 seconds. Back to top Troubleshooting If you have a server named "MyWrongServername", you may not receive an error. Back to top For more information about the .NET hosting provider, please visit the following MSDN Web site: Inside .NET Managed Providers http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndive/html/data010112001.asp Back to top The information in this article applies to: Microsoft ADO.NET (provided with .NET Frame) Microsoft Visual C # .NET (2002) Reserved: 2002-6-17 (1.0) Keyword KBDSupport KBGRPDSVBDB KBHOWTO KBHOWTOMASTER KBOLEDB KBSYSTEMDATA KB308650 KBAUDDEVELOPER