using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.SqlServerCe; using System.Data.SqlClient; using System.Data.Sql; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { SqlCeConnection Connection = new SqlCeConnection("Data Source=E:\\Northwind.sdf;"); try { Connection.Open(); SqlCeCommand Command = Connection.CreateCommand(); Command.CommandText = "SELECT * FROM Employees"; SqlCeDataReader Reader = Command.ExecuteReader(); while (Reader.Read()) { Console.WriteLine("\n RegionId={0}\t RegionDescription={1}",Reader.GetSqlInt32(0).Value,Reader.GetSqlString(1).Value); } } catch (SqlCeException ex) { Console.WriteLine(ex.Message); ; } finally { if (Connection.State == System.Data.ConnectionState.Open) { Connection.Close(); } } Console.ReadKey(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)