469,586 Members | 2,191 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,586 developers. It's quick & easy.

Using Microsoft Enterprise Libary with SQL server CE

livid86
Hello,

I'm trying to create a simple test project that will read and write from a SQL CE database. I have written a small amount of code and getting weird errors that i have googled and do not understand.

This is the code i have got
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using Microsoft.Practices.EnterpriseLibrary.Data.SqlCe;
  10. //using Microsoft.Practices.EnterpriseLibrary.Data;
  11.  
  12. namespace simpleDatabaseConnect
  13. {
  14.     public partial class Form1 : Form
  15.     {
  16.         public Form1()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.  
  21.         private void Form1_Load(object sender, EventArgs e)
  22.         {
  23.  
  24.             dataGrid1.DataSource = null;
  25.             string db =  @"Data Source=simpleDatabase.sdf;";
  26.             SqlCeDatabase database = new SqlCeDatabase(db);
  27.             DataSet ds = database.ExecuteDataSet("SELECT * FROM tblStatus");
  28.  
  29.         }
  30.     }
  31. }
Nothing fancy at all. But for some reason the code is still getting the following errors.

Expand|Select|Wrap|Line Numbers
  1. Error    1    The type 'System.Data.IDataReader' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.    C:\Users\Cory\Documents\Visual Studio 2008\Projects\simpleDatabaseConnect\simpleDatabaseConnect\Form1.cs    27    13    simpleDatabaseConnect
  2.  
  3.  
  4. Error    2    The type 'System.Data.Common.DbCommand' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.    C:\Users\Cory\Documents\Visual Studio 2008\Projects\simpleDatabaseConnect\simpleDatabaseConnect\Form1.cs    27    13    simpleDatabaseConnect
  5.  
  6.  
  7.  
I have imported system.data as a reference and as you can see i'm using it.

Thanks for your help.
Cory Thompson
Jul 23 '09 #1
0 1562

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Tom Edelbrok | last post: by
9 posts views Thread by reshugoyal | last post: by
13 posts views Thread by =?Utf-8?B?Um9nZXIgTWFydGlu?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.