No .Fill Method in Data Adapter

G

Guest

I am developing a Smart Device project for my Symbol MC9000 Windows Mobile
handheld. I am trying to make a simple connection to a SQL server. My problem
is my Data Adapter object does not have a .FILL method as it always has in
normal C# desktop apps.

I also noticed I cannot do a dataadapter object.dispose() either (i.e da.
Dispose() ). Am I missing something or is this development environment for
mobile just that limited?

The intellisense only shows the following methods/properties for the da
object.
..DeleteCommand, .InsertCommand, .RowUpdated, .RowUpdating, .SelectCommand,
and .UpdateCommand.

That all it lists. Do I need to install something maybe?
I have never done a mobile app so this is all new to me.
Any help would be greatly appreciated.
Below is some of the code I am developing just to make the connection.

Thanks,
David


// Connection String for MSSQL Server
string Connection_String = "Initial Catalog=WINSTSDB;Data
Source=DB2ML350;workstation id=Symbol_MC9000w;packet size=4096;integrated
security=SSPI";

// Setup SQL Connection object
SqlConnection dbConn = new SqlConnection( Connection_String );

// Create Data Adapter object with SQL statement.
SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM RackTemp WHERE SID =
'" + strSidcode + "'",dbConn);

// Define a Data Table object
System.Data.DataTable WinstisTable = new DataTable();

try
{

// Pull in data into data table object named WinstisTable
conn.Open();
da.Fill( WinstisTable );

}
catch(Exception exc)
{
MessageBox.Show(exc.Message.ToString(),"Error",MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);

}
finally
{

// Close connection
conn.Close();

}
 
G

Ginny Caughey [MVP]

David,

All data adapters have a Fill method - that's part of the IDataAdapter
interface. How are you using it? Did you include a reference in your
project?
 
L

Lonifasiko

I've had same or similar trouble with that.

I converted a CF 1.0 project with VS.NET 2005 Beta2, compiled and
obtained millions of errors saying that DataAdapter has no definition
for "Fill" method. And intellisense only showed the methods told by
dcuff. Really incredible! I tried everything: Removind and adding all
kind of references........because when compiling, it says that you must
add a reference to System.Data.Common, but when you try to add this
reference, gives you an error because you are trying to add a 2.0 DLL
to a CF 1.0 porject, and that is not possible.

I think that is a VS.NET 2005 Beta2 conversion bug. The worst thing is
I cannot compile my CF 1.0 application with VS.NET 2005 Beta2. I cannot
modify it because I removed VS.NET 2003.

Hope it helps.

Regards.
 
P

Peter Foot [MVP]

Part of the problem with transitioning code is that v1.0 had some of the
base classes in a separate System.Data.Common.dll, however in v2.0 this is
merged in with the main System.Data.dll (which is closer to the desktop
implementation).
The problem is when you try to use a dll compiled against v1.0 on v2.0
because it will reference the non existent System.Data.Common.dll. While the
runtime can redirect the System.Data.dll reference to the v2.0 version when
you use this in a v2.0 project, it can't use the classes in System.Data 2.0
in place of those in System.Data.Common v1.0. The only workaround that I
know of is to recompile the dll against v2.0 so it has just the System.Data
reference.

Peter
 
G

Guest

"And the WINNER IS....."

Alex Feinman

Adding the System.Data.Common fixed my problem.

I had System.Data.SqlClient and a few other references but not the .common.

Thanks Alex.
 
G

Guest

OOPS ALEX, Sorry I was actually in the wrong project. I thought I was in my
smart device app but I was actually looking at a desktop app for comparison.
The .fill only showed because I was in a desktop solution and not my smart
device solution. So my smart device app already had the System.Data.Common
reference in it but it still does not give the .fill method. Sorry for the
confusion on my last post. So I am still at the same point as yesterday.

David
 
G

Guest

Here are all the references I have in the smart device app.

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

if this helps. Maybe I have something wrong here.


David
 
G

Guest

OKAY...I am finally good for sure now. It was programmer ignorance. I am
really just starting out in C# and when Alex suggested I add a reference, I
thought he was talking about the using statement. I found out it was because
I did not add a reference to those items in the Project, Add Reference
option. I still have so much to learn. But that one is embarrassing. Thanks
so much for everyone's help to the novice.

David
 
G

Ginny Caughey [MVP]

David,

Don't be embarrassed - we've probably all forgotten a reference once or
twice (or more times <g>), and when Intellisense doesn't work, that's
usually why.
 
L

Lonifasiko

Adding reference to DLL System.Data V2.0 solved your problem? You are
developing a new application, not a conversion with VS.NET 2005, aren't
you?

My project, which is Smart Device project developed with CF 1.0, was
converted with VS.NET 2005 Beta2 but continues using CF 1.0.?

And have same problem. I can add a reference to System.Data V2.0 but
logically application does not compile because that DLL is not
compatible.

It migth be a VS.NET 2005 Beta2 bug while converting projects? This is
the first time I have serioues problems while converting a project with
VS.NET 2005 Beta2, and I think it cannot be resolved with this version.

I'll wait to install VS.NET 2005 and try.

Thanks.
 

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