Connection to SQL Server

O

olli

I am a VB6 programmer starting out in vb.net. I have been trying to
connect to a SQL Server database using SQLClient from a pocket pc, but
am unable to connect.

my code is:
cn = new System.Data.SqlClient.SqlConnection
cn.ConnectionString = "User
id=sa;password=password;database=test;server=192.168.0.2"
cn.Open()

However, the connection always fails with the error "SQL Server does
not exist or access denied". I am running the emulator on one PC, the
SQL Server is on another PC in my network. I am assuming that the
emulator can 'see' the other PC, since I can open a terminal server
client from the emulator to it. I wrote a 'normal' vb.net program with
the same code and that connected straightaway, so I am assuming the
connection string is okay. This ran on the same machine the emulator
is on. So I think it must be one of:

* the pocket pc can't use the same sort of connection string as a
normal pc?
* the link to sql server from the emulator is different to the link to
the same machine using terminal server client?

Does anyone have any ideas?

Olli
 
A

Andy Sjostrom

Your connection string looks fine. Early .NET CF builds, ie pre-release, had
an issue which sounds like the one you are describing.
What version VS.NET, .NET CF, SDK and emulator are you using?


Andy Sjostrom
MS MVP - Mobile Devices
 
O

olli

I haven't tried it using the cradle, but that is because I believe it
is on a different network using ActiveSync, and so wouldn't be able to
pick up SQL Server. At the moment my pocket pc is networkless, though
I'm currently trying to get a wireless cf card. I tried it on another
pocket pc that was part of our work network and couldn't connect with
that. I don't know if the error message was the same, because at the
time, I didn't know how to use the SQLException object.
 
O

olli

I'm using VS.NET 2003 that I received with my MSDN subscription that I
had last year, the .NET CF SDK v1.0.5000. The emulator is the Pocket
PC 2002 emulator (version 4.1.0 Build 14)

Olli
 
A

Andy Sjostrom

OK. No pre-release bits in those version numbers.
Try this (figuring out if you've got a working connection to your PC):
1. Share a folder on your PC
2. Connect to the folder from the emulator's File Explorer


Does that work?

Andy Sjostrom
Microsoft MVP - Mobile Devices
 
O

olli

I'll try that this evening (I'm currently at work, and that's on my
home PC). I didn't realise you could connect to network drives using
File Explorer!

However, this has got me thinking about my network links. Both IE and
TS Client would work over the ActiveSync connection, so my initial
theory that the emulator was on my network already could be incorrect
and that instead it is emulating a serial/usb connection. Can anyone
confirm if that is how the emulator works, and if so, is it possible
to emulate a true network connection eg over a wireless link?

Olli
 
O

olli

Thanks for your help. I read your article and tried it out with my
ipaq. I still get an error connecting: "General Network Error". When I
try to connect when the Ipaq is not in the cradle (i.e. completely
un-networked) I get the "Cannot find server" message. I tried your evb
winsock program and confirmed the ipaq had the IP address shown in the
article, but I was unable to map a network drive from the ipaq.
However, having never done this before, maybe I was using the wrong
syntax; I was using the standard Windows \\machinename\driver format,
which I also tried with IP address. IE worked okay on the cradle, both
to the internet and to my local router's configuration page.

It's increasingly looking like my problems are down to my network
configuration, so it looks like I'm posting to the wrong group!

Olli
 

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