开发者

Can't open a connection to SQL Server 2005 from a pocketpc (windows mobile 6)

I'm trying to connect from a pocket pc app (windows mobile 6) to a SQL Server 2005, but no matter how hard I try it didn't work. I checked every possible configuration for enabling tcp on SQL Server, I tested many connection strings, but still have the problem when I attempt to open the connection, I'm sure it's not a network issue because I can ping on my pocket pc from the server machine without any problem and the firewall on my server machine is disable开发者_开发技巧d : here is one of the connection strings I used :

Data Source=10.168.0.160,1433;Initial Catalog=pos;Trusted_connection=yes;user id=myuserid;password=mypassword

where pos is the name of my database

Thank you for your help


Well, you cannot have both a trusted connection and specify an explicit user name and password at the same time - it's either or.

EITHER you connect to your server with the trusted connection, e.g. your Windows credentials - then your connection string looks something like this:

Data Source=10.168.0.160,1433;Initial Catalog=pos;Integrated Security=SSPI;

OR alternatively, you use an explicit user name and password - but in that case, you CANNOT also use trusted connection / integrated security at the same time!

In this case, your connection string would be something like:

Data Source=10.168.0.160,1433;Initial Catalog=pos;user id=myuserid;password=mypassword

Check out the ConnectionStrings.com for loads of samples of valid connection strings for SQL Server


You can't use Integrated Windows Authentication from a mobile device because the device doesn't have any concept of a logged in user. You also have to make sure the server has remote connections turned on.

Here's a simple example of how to get it working.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜