DataTable t = new DataTable(); SqlCeCommand clientCmd = clientConnection.CreateCommand(); Debug.WriteLine("Getting data.."); strSql = "SELECT name, redeemed, redeemedTime, barcode, postcode, ticketName, status, digits FROM tickets"; using (SqlCeDataAdapter a = new SqlCeDataAdapter( strSql, clientConnection)) { a.Fill(t); } foreach (DataRow r in t.Rows) { Debug.WriteLine("x"); //insert code would go here}