OleDbException.Message : OleDbException « System.Data.OleDb « C# / C Sharp by API






OleDbException.Message

 

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;


public class MainClass {
  public static void Main(){
        string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\Northwind.mdb";
        OleDbConnection conn = new OleDbConnection(ConnectionString);
        try
        {
            conn.Open();
        }
        catch(OleDbException ae)
        {
            for (int i = 0; i < ae.Errors.Count; i++)
            {
                Console.WriteLine(ae.Errors[i].Message + " - " + ae.Errors[i].SQLState);
            }
        }
  }
}

   
  








Related examples in the same category