title: Retrieving data of type SqlDbType.Image from SQL Server CE database
body: <p>I have the following method i am using to save an object into an SQL Server CE database. I am now stuck on how to get the record back out.</p>
  
  <pre><code>public void SaveRecord(LabRecord _labrecord)
  {
          try
          {
              conn = new SqlCeConnection(_connectionString);
              conn.Open();
              MemoryStream memStream = new MemoryStream();
              StreamWriter sw = new StreamWriter(memStream);
  
              sw.Write(_labrecord);
  
              SqlCeCommand sqlCmd = new SqlCeCommand("INSERT INTO LabTransactions([TrasactionType], [CAM], [TransactionObject]) VALUES ('ResultTest', 1234, @Image)", conn);
  
              sqlCmd.Parameters.Add("@Image",  SqlDbType.Image, Int32.MaxValue);
  
              sqlCmd.Parameters["@Image"].Value = memStream.GetBuffer();
  
              sqlCmd.ExecuteNonQuery();
  
          }
          finally
          {
              conn.Close();
          }
      }
  </code></pre>
  
  <p>Update</p>
  
  <p>I am looking to make another class that returns a specific record.</p>
  
  <pre><code>public LabRecord getRecord(int transactionId)
  {
          LabRecord returnRecord = null;
  
          try
          {
              conn = new SqlCeConnection(_connectionString);
              conn.Open();
  
              //.... Get the record
          }
          finally
          {
              conn.Close();
          }
  
          return returnRecord;
      }
  </code></pre>