1
Reply

CE problem,

jinwolf

jinwolf

Dec 9 2003 10:20 AM
1.6k
Hi all I have a problem with CE. I am writing a database application for PocketPC using SQlServer CE 2000 and C#. The problem is I get an unhandled error, see code below: protected void GetData() { SqlCeConnection sqlConn = new SqlCeConnection("Persist Security Info=False;password=chris;Data Source=Zettel"); SqlCeCommand sqlZettel = new SqlCeCommand("SELECT Gekauft, Item, Menge, Messe FROM Zettel", sqlConn); if(sqlZettel.Connection.State == ConnectionState.Closed) sqlZettel.Connection.Open(); // The PROBLEM!! SqlCeDataReader drZettel = sqlZettel.ExecuteReader(CommandBehavior.CloseConnection); // The PROBLEM!! while(drZettel.Read()) { ListViewItem lvItem = new ListViewItem(); lvItem.Checked = Convert.ToBoolean(drZettel["Gekauft"].ToString()); lvItem.SubItems.Add(drZettel["Item"].ToString()); lvItem.SubItems.Add(drZettel["Menge"].ToString()); lvItem.SubItems.Add(drZettel["Messe"].ToString()); listView1.Items.Add(lvItem); } drZettel.Close(); sqlZettel.Connection.Close(); } can anyone see anything wrong with what I am doing? I have followed the sample code from Microsoft but it still doesn't work. Thanks in advance Lee

Answers (1)