please help - unable to connect to sql server from handheld device via usb activesync and sqlclient

D

dotnetfellow

I have tried using the SqlClient class to connect to the database, but
I haven't had much success. Here is my
setup:

Desktop/Workstation has Windows XP, ActiveSync, .NET Framework 2.0, and
SQL Server 2005. The production Workstation
will have 2000; so I do want to ensure SQL Server 2000 compatibility
with my solution.

Handheld device is an Intermec 751g with docking station, hooked to PC
host using USB connector cable and ActiveSync, Windows CE 4.2, .NET
Compact Framework 2.0 with SP1 and
latest patch.

Development tools consist of Visual Studio 2005 and C# .NET language.

Note that when I attempt to ping my desktop from the handheld command
prompt I get "transmit failed, error code
11010".

Also, I am able to access the Internet from my handheld device.

My error is encountered when I execute this fill code:

int returnValue = this.Adapter.Fill(dataTable);

Please note that all of my code is generated by the VS 2005 IDE at this
juncture, as I am simply trying to get the
plumbing to work.

Here is the error that I encounter:

System.Data.SqlClient.SqlException was unhandled
Message="SqlException"
Class=20
LineNumber=0
Number=6
Procedure="ConnectionOpen (Connect())."
Server="09Q-GHAZEL2\\SQL2K5"
Source=".Net SqlClient Data Provider"
State=0
StackTrace:
at System.Data.SqlClient.SqlConnection.OnError()
at System.Data.SqlClient.SqlInternalConnection.OnError()
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Connect()
at System.Data.SqlClient.SqlInternalConnection.OpenAndLogin()
at System.Data.SqlClient.SqlInternalConnection..ctor()
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.QuietOpen()
at System.Data.Common.DbDataAdapter.FillInternal()
at System.Data.Common.DbDataAdapter.Fill()
at System.Data.Common.DbDataAdapter.Fill()
at
DeviceApplication1.AdventureWorksDataSetTableAdapters.ContactTableAdapter.Fill()

at DeviceApplication1.Form1.Form1_Load()
at System.Windows.Forms.Form.OnLoad()
at System.Windows.Forms.Form._SetVisibleNotify()
at System.Windows.Forms.Control.set_Visible()
at System.Windows.Forms.Application.Run()
at DeviceApplication1.Program.Main()





Thanks again for your insight. Sincerely, -Dotnetfellow
(e-mail address removed)
 
D

dotnetfellow

I have now configured my handheld device to ping on the network over an
ethernet drop. However, I am still getting the same error. I am using
the code generated by VS 2005 for connecting. I have also incorporated
variations on my connection string based on info I have collected at
other web forums such as forums.microsoft.com. However, I am still
getting the same error.

The error that I get is the same error that I copied in the thread
above. It is failing on the attempt to open the connection. Thanks.



Sincerely, -Dotnet fellow
 
D

dotnetfellow

Got it working.

First I had to figure out how to connect to the server specifically. I
found this article here helped tremendously.


How to: Configure Express to accept remote connections

http://blogs.msdn.com/sqlexpress/archive/2005/05/05/415084.aspx


Then I had to get the connection string right. Here is the connection
string that worked:

Data Source=197.162.5.100,1433;Initial Catalog=AdventureWorks;Persist
Security Info=True;User ID=ausername;Password=apassword;


Some things that I found a little confusing.

I can do a port scan using vxUtil from the handheld, against the target
port, but I can not do a ping using vxUtil from the handheld, against
the target ip address.

I found later that ActiveSync 4.0 and above do not provide TCP/IP
Network connectivity. If one needs USB ActiveSync connectivity to the
LAN, then you must use AS 3.8.


Also, when doing a port scan with vxUtil, a successful return status
will look like this:

Port: 1433 is open
Port Scan Complete


If the port scan was unsuccessful then it will merely return:

Port Scan Complete


In the end, I am able to get the SqlClient namespace in .NET 2.0 CF to
connect me to SQL Server 2005 on the host computer over a USB
ActiveSync connection.



Finally, if you want to connect and debug from VS over a Ethernet drop,
without the use of USB ActiveSync, you will find this article step you
through that process.


Debugging on CE5.0 device without Activesync

http://blogs.msdn.com/vsdteam/archive/2005/04/28/413304.aspx
 

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