Odbc Error Handler : ODBC : Database C# Source Code


Custom Search

C# Source Code » Database » ODBC »

 

Odbc Error Handler








    
 

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);
            }
        }
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Database
» ODBC