SQLServer with the CompactFramework?

Z

Zanna

Hi all,

I wonder if it is possible to connect to a SQLServer DB from a PocketPC with
the CompactFramework on it.

If yes, can someone give me an example of connecting to a DB and fill a
DataSet?

And... what are the .dll referenced?

Thank you :)
 
A

Alex Feinman [MVP]

You simply need to use SqlClient class, which is available in CF inside
System.Data.SqlClient and mimics functionality of the same class one the
desktop. One thing to keep in mind is that if you are using Windows
authentication on the SQL server you will need to provide both "Integrated
Security=SSPI" and User ID and Password.

For more information look at the following thread:

http://groups.google.com/groups?hl=...lU7xfWCDHA.1548%40TK2MSFTNGP12.phx.gbl&rnum=2
 
Z

Zanna

Alex Feinman said:
You simply need to use SqlClient class, which is available in CF inside
System.Data.SqlClient and mimics functionality of the same class one the
desktop.

mmmh... I try to do a really simple app (just a window with a connection to
a DB).

When I copy the .exe to the PocketPC, and I run it, it give me this
exception: MissingMethodException while it try to do the
DataAdapter.Fill(DataSet) method.

So I think I'm missing some assembly.
That's why I asked the list of referenced files.

Thank you.
 
A

Alex Feinman [MVP]

How are you deploying your app? If you do it via debugger, all necessary
components will be copied/installed automatically
Somehow I get the feeling that you are building for desktop but trying to
run it on the device - won't work
 
B

Brian Eng

I *think* this is because you need a reference to System.Data.Common.

Brian Eng
MCSD .NET
(e-mail address removed)

Alex Feinman said:
How are you deploying your app? If you do it via debugger, all necessary
components will be copied/installed automatically
Somehow I get the feeling that you are building for desktop but trying to
run it on the device - won't work
 
A

Alex Feinman [MVP]

If she didn't have a reference to System.Data.Common, it would not compile

Brian Eng said:
I *think* this is because you need a reference to System.Data.Common.

Brian Eng
MCSD .NET
(e-mail address removed)
 
B

Brian Eng

Sorry, I should clarify. When you first create a C# .NET CF project, a
reference to System.Data.Common is not shown in Solution Explorer. If you
try to call the Fill method of a DataAdapter without first explicitly adding
a reference to System.Data.Common (so that it shows up in Solution
Explorer), it does raise a MissingMethodException. At least this has been
my experience - not sure if this specific to C#, a specific environment, or
otherwise.

HTH

--
Brian Eng
MCSD .NET
(e-mail address removed)
 
Z

Zanna

Brian said:
Sorry, I should clarify. When you first create a C# .NET CF project, a
reference to System.Data.Common is not shown in Solution Explorer. If you
try to call the Fill method of a DataAdapter without first explicitly adding
a reference to System.Data.Common

mmmh... that can be... I'll try tomorrow, when I'll get the PocketPC
back to my office :)

Thank you!
 

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