title: ExceptionCode: 0xc0000005 with sqlcereader
body: <p>I have a Windows CE Device. I am trying to run an application which is using SqlServerCe. When I try to run <code>ExecuteReader.Read()</code> method it is throwing an exception like below:</p>
  
  <pre><code>Error
  ExceptionCode: 0xc0000005
  Exception Adress : 0x4d776569
  Reading: 0x4d776568
  
  at
  NativeMethods.GetKeyInfo(IntPtrpTx,String pwszBase Table, IntPtrprgDbKeyInfo, Int 32 cDKeyInfo, IntPtr pError)
  at
  SqlCeDataReader.FillMetaData(SqlCeCommand command)
  at
  SqlCeCommand.InitializeDataReader(SqlCeDataReader reader, Int32 resultType)
  at
  SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResulSetOptions options)
  at
  SqlCeCommand.ExecuteReader(CommandBehavior behavior)
  at
  Prothocol.checkReadACK(SerialPort serialport,SqlCeCommand sql_cmd)
  at
  Message.communicationThread()
  </code></pre>
  
  <p>The other methods of Sql doesn't cause a problem (Like ExecuteNonQuery). </p>
  
  <p>I have Microsoft SQL Server Compact Edition\v3.5 and .NET Framework 3.5 on that device.</p>
  
  <p>And I am using VS 2008 Smart Device Application for developing. </p>
  
  <pre><code> public static void checkReadACK(SerialPort serialport, SqlCeCommand sql_cmd)
          {
              String s;
              long selectedID;
              s = "SELECT receivedNum,id from MESSAGE_INBOX where (status = 2)"; //Status: 0 read and replied. 1 unread. 2 read and notreplied.
              try
              {
                  sql_cmd.CommandText = s;
                  sql_cmd.ExecuteNonQuery();
                  SqlCeDataReader reader = sql_cmd.ExecuteReader();
  
  
                  while (reader.Read())
                  {
                      sendReadACK(reader.GetString(0),serialport);
                      selectedID = reader.GetInt64(1);
                      s = "UPDATE MESSAGE_INBOX SET status = 0 WHERE (id = " + selectedID + ")";
                      sql_cmd.CommandText = s;
                      sql_cmd.ExecuteNonQuery();
                  }
              }
              catch //(Exception err)
              {
                  //  MessageBox.Show(err.Message.ToString());
              }
          }
  </code></pre>
  
  <p>And this is the function where expection occurs.</p>