ToString
Exception
をオーバーライドします
このメソッドにより、この例外の完全修飾名、Message
プロパティのerror
メッセージ、InnerException.ToString()
メッセージおよびスタック・トレースを戻します。
宣言
// C# public override string ToString();
戻り値
例外の文字列表現
例
// C# using System; using Oracle.DataAccess.Client; class ToStringSample { static void Main() { string constr = "User Id=scott;Password=tiger;Data Source=oracle"; OracleConnection con = new OracleConnection(constr); con.Open(); // Create an OracleCommand object using the connection object OracleCommand cmd = con.CreateCommand(); try { cmd.CommandText = "insert into notable values (99, 'MyText')"; cmd.ExecuteNonQuery(); // This will throw an exception } catch (OracleException ex) { Console.WriteLine("Record is not inserted into the database table."); Console.WriteLine("ex.ToString() : " + ex.ToString()); } } }