SqlCeConnection conn = null; SqlCeCommand cmd = null; SqlCeDataReader rdr = null; try { conn = new SqlCeConnection("Data Source = AdventureWorks.sdf"); conn.Open(); cmd = new SqlCeCommand("SELECT * FROM DimEmployee", conn); rdr = cmd.ExecuteReader(); while (rdr.Read()) { int employeeID = rdr.GetInt32(0); // or: rdr["EmployeeKey"]; string lastName = rdr.GetString(5); // or: rdr["FirstName"]; } rdr.Close(); cmd.Dispose(); } finally { conn.Close(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)