Why is this SqlCeCommand ExecuteReader call failing?
问题 I adapted my code below from "Microsoft .NET Compact Framework" by Wigley and Wheelwright: SqlCeConnection cn = new SqlCeConnection(@"Data Source=\My Documents\Traffic.sdf"); String sSQL= "SELECT CarID, Reg, Location FROM Cars"); SqlCeCommand cmdSelect = new SqlCeCommand(sSQL, cn); cmdSelect.CommandType = CommandType.Text; SqlCeDataReader dtr = cmdSelect.ExecuteReader(CommandBehavior.Default); // It's "cmd." instead of "cmdSelect." in the book, but that doesn't compile while (dtr.Read()) {