OdbcException.Source プロパティ
アセンブリ: System.Data (system.data.dll 内)



OdbcErrorCollection コレクション内の最初の OdbcError の Message、Source、および NativeError プロパティを表示する例を次に示します。
Public Sub ShowOdbcException() Dim mySelectQuery As String = "SELECT column1 FROM table1" Dim myConnection As New OdbcConnection _ ("DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=northwind;") Dim myCommand As New OdbcCommand(mySelectQuery, myConnection) Try myCommand.Connection.Open() Catch e As OdbcException Dim errorMessage As String = "Message: " & e.Message & vbCrLf & _ "Source: " & e.Source Dim log As System.Diagnostics.EventLog = New System.Diagnostics.EventLog() log.Source = "My Application" log.WriteEntry(errorMessage) Console.WriteLine("An exception occurred. Please contact your system administrator.") End Try End Sub
public void ShowOdbcException() { string mySelectQuery = "SELECT column1 FROM table1"; OdbcConnection myConnection = new OdbcConnection("DRIVER={SQL Server};SERVER=MyServer;Trusted_connection=yes;DATABASE=northwind;"); OdbcCommand myCommand = new OdbcCommand(mySelectQuery,myConnection); try { myCommand.Connection.Open(); } catch (OdbcException e) { string errorMessage = "Message: " + e.Message + "\n" + "Source: " + e.Source; System.Diagnostics.EventLog log = new System.Diagnostics.EventLog(); log.Source = "My Application"; log.WriteEntry(errorMessage); Console.WriteLine("An exception occurred. Please contact your system administrator."); } }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からOdbcException.Source プロパティを検索する場合は、下記のリンクをクリックしてください。

- OdbcException.Source プロパティのページへのリンク