OleDbConnection : OleDbConnection : Database C# Source Code


Custom Search

C# Source Code » Database » OleDbConnection »

 

OleDbConnection








    
 

using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.OleDb;

class MainClass {
    public static void Main() {
        using (OleDbConnection con = new OleDbConnection()) {
            con.ConnectionString = "Provider=SQLOLEDB;" +     
                @"Data Source=.\sqlexpress;" + 
                "Initial Catalog=Northwind;" + 
                "Integrated Security=SSPI";    
            con.Open();

            if (con.State == ConnectionState.Open) {
                Console.WriteLine("  Server Version = " + con.ServerVersion);
            } else {
                Console.WriteLine("OleDbConnection failed to open.");
                Console.WriteLine("  Connection State = " + con.State);
            }
        }
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Database
» OleDbConnection