Different connection string syntax between CF and regular Framework?

M

Mike Von Stein

Hopefully someone know the answer to this. I'm trying to connect to
the same SQL Server 2000 on a remote machine in a VS.Net 2003 1.1
framework project and a separate project targeting Compact Framework
for PocketPC 2002. Everything is exactly the same in both, but the
connection string works in the regular VS.Net 2003, but not under the
Compact Framework! I've tried the CF in both the emulator and an
actual device in the cradle.

The working connection string is like this:
data source=MY_SQL_SERVER;user id=MY_USERID;initial
catalog=MY_DB;password=MY_PASSWORD

I've tried many, many things based on Google postings and MS KB
articles/examples, but nothing seems to work. Including:
- specifing the server=xxx.xxx.xxx.xxx,1433.
- adding persist security info = false
- trying to reference a named instance (but there is only a default
instance on the server in question)
- etc

I've used connection strings successfully for several years to connect
to Oracle, DB2, SQL Server,Access, etc in regular ADO, but am fairly
new at the dotnet and pocket pc world so maybe I'm overlooking
something obvious. Many MS & newsgroup examples reference
"localhost", but this SQL server is on a different machine.

Thanks in advance.

Mike
 
W

William Ryan eMVP

This is the exact string i use (I just changed the data in it)
Dim cn As New SqlConnection("User ID=xxxxxxxxxxx; Password=xxxxxxxxxxx;
Server=192.168.1.53;Database=xxxxxxx")

That should work for you, let me know if it doesn't.
--

W.G. Ryan, eMVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
 
M

Mike Von Stein

William-

Thanks for the suggestion. Your connection string worked fine in my
normal Framework project, but *still* wouldn't work in my CF project.
I'm baffled!

Thanks,
Mike
 
M

Mike Von Stein

Just had a thought... Is there anything special I'd have to install
("Compact Framework") etc on the server? It's a Windows 2003 Server.

Thanks,
Mike
 
W

William Ryan eMVP

Not that I can think of. I've run that CS with quite a few different pdas
on a few different OS and can't think of anything. Is it giving you a
permission denied or server does not exist error or does it just timeout on
the connection?

--

W.G. Ryan, eMVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
 
P

Paul G. Tobey [eMVP]

Can you reach the general network from your CE device? I'm asking if there
is an operational network connection.

Paul T.
 
M

Mike Von Stein

I'm getting something like: "server does not exist or unknown
user/name password" after a really long timeout period...

Thanks,
Mike
 
W

William Ryan eMVP

Hi Mike:

I've played with it and when I use the other syntax for the connection
string, I can replicate it. However with the one that posted, it seems to
work in every case I can throw at it (I know, that does nothign for your
problem).

Here's another thing I'd try. Run a trace on the SQL Server and then run
your program. You'll be able to see if it's connecting and just rejecting
the credentials or if it's not seeing the db. The resolutions would be a
bit different. However I'm guessing that it's not seeing the db at all - if
it does though and it's just rejecting it, then it's a permissioning
problem - I'm guessing this isn't the case though since the exact same thing
works on the full framework. Anyway, if it doesn't see the server than it's
going to be more difficult to resolve but at least we know for sure where we
stand.

--

W.G. Ryan, eMVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
 
M

Mike Von Stein

Thanks. I will try that and also try Paul's suggestion about seeing
the network, but may take a day or two. I've got to get some other
stuff completed before I get back to it.

I'm thinking it's not seeing the database at all and it's got
something to do with network connectivity. But I'm confused because
when I used Odyssey Software's CEFusion with embedded VB it sees the
IP address that the server's on fine on the same device. Would think
it would be the same unless it's something to do with CF...

Thanks again,
Mike
 
M

Mike Von Stein

FYI in case anyone has a similar problem... Resolution to this was
the SQL Server was listening on a nonstandard port. One way to access
configuration is to right click on the SQL Server Group in Enterprise
Manager and look under Network Configuration for TCPIP.
 

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