SqlCeDataAdapter and Fill(ds)

  • Thread starter Michael Morisoli
  • Start date
M

Michael Morisoli

I am working on a .NET Compact Framework app using SqlCe and have run into a
problem using the Fill method of the SqlCeDataAdapter.



For some reason, the version of the framework I am running does not support
the fill method. The documentation in my Visual Studio .NET 2003 says the
method is there, but when I try to compile the application VS tells me there
is no such method.



Has anybody seen this before. Any clues as to how to fix it? Perhaps I am
missing a framework update I don't know about. My framework says it is v1.1
but when I look at the actual System.Data.SqlServerCe.dll it says it is
v1.0.5.0000



Thanks



Mike
 
P

Peter Foot [MVP]

You need to add a reference to System.Data.Common to your project to use
this method. Unfortunately its not added automatically.

Peter
 
M

Michael Morisoli

Peter, I already had the reference and still no workie.

Here is a code snypit

using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using System.Data.Common;
using System.Data.SqlServerCe;
using System.IO;

more code....


SqlCeConnection cn = new SqlCeConnection("Data Source=\\My
Documents\\ReceivingData.sdf;");
cn.Open();
SqlCeDataAdapter da = new SqlCeDataAdapter();
da.SelectCommand = new SqlCeCommand("SELECT * FROM Vendors", cn);
DataSet ds = new DataSet("Vendors");
da.Fill(ds);
cn.Close();

The error is on da.Fill(). Any thoughts?
 
M

Michael Morisoli

My mistake. I had a using statement, but i did not create a reference.
Works fine now, thanks.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top