OdbcException.Message
using System; using System.Diagnostics; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Data.Odbc; public class MainClass { [STAThread] static void Main() { OdbcConnection cn; try { cn = new OdbcConnection(); cn.ConnectionString = "driver={SQL Serve};server=.;uid=admin;pwd=pw;database=biblio"; cn.Open(); } catch (OdbcException ex) { if (ex.InnerException != null) { Debug.WriteLine("InnerException:" + ex.InnerException.Message); } MessageBox.Show(ex.ToString()); Debug.WriteLine("Message:" + ex.Message.ToString()); Debug.WriteLine("Source:" + ex.Source.ToString()); Debug.WriteLine("StackTrace:" + ex.StackTrace.ToString()); Debug.WriteLine("TargetSite:" + ex.TargetSite.ToString()); // Not in OleDB if (ex.HelpLink != null) { Debug.WriteLine("HelpLink:" + ex.HelpLink); } } } }