x

Can´t connect to a desktop SQL 2000 from smartdevice connected by ActiveSync with USB

Hi everyone.

For the last few days i´ve been searching for a solution to my problem. I´m trying to connect to a local desktop SQL Server 2000 in my development PC from a smartdevice emulator using VS 2008 with C#. I can navegate from the emulator and i can connect to a SQL CE database in the emulator.

I've tried pocketc PC 2003 and Windows mobile 5 and 6, but makes no difference.

I'm developing in a VMWare workstation using WXP x86 SP3 on a physical W7 x64 OS, and networking by WIFI, but since it´s a local connection, i don´t think that´s the problem.

I've tried also named and IP connections.

The physical handheld has no network device, so i must try to connect by USB port using activesync when the user cradles the device.

The error i´m getting is "ConnectionRead (recv())." {"SqlException"} Number 11

Here´s my code:

using System.Data.SqlClient;

namespace SmartDeviceProject7 { public partial class Form1 : Form { public Form1() { InitializeComponent(); }

    private void Form1_Load(object sender, EventArgs e)
    {
        string connString = "Data Source=192.168.16.105;Initial Catalog=BD;User Id=user;Password=**;";
        string cmdText = "select Id, Descripcion from Depositos";

        using (SqlConnection conn = new SqlConnection(connString))
        {
            conn.Open();
            SqlCommand cmd = new SqlCommand(cmdText, conn);
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                System.Diagnostics.Debug.WriteLine(string.Format("{0}, {1}", reader[0], reader[1]));
            }
            reader.Close();
        }
    }

Thanx in advance for any help.

Néstor.
more ▼

asked Dec 06, 2010 at 01:05 PM in Default

Malkav gravatar image

Malkav
21 1 1 1

Which version of VS2008 are you using? Is it Express Edition?
Dec 06, 2010 at 03:10 PM Mister Magoo

Hi Pavel and Mister Magoo, i´m using VS 2008 Pro with a SQL server 2000 SP4 with a unique instance and with mixed authentication.

The problem seems to be in an earlier instance of the connection process, because i got the same error no matter wich user or password i use in the connection string.

I´m trying now some suite of functions for the emulator "vxUtil" to see if i can ping the server from the emulator.

I´ve tried on a physical pc with WXP and got the same error, so it´s not the vmware, it has to be some connectivity issue but i'm really getting out of options...

Thank you for reading this!

Dec 07, 2010 at 05:12 AM Malkav
If you are using a named instance, you have to include the instance name in the connection string like Data Source=192.168.16.105\Instance_Name. Also check protocols you are using in the SQL Server Configuration Manager.
Dec 07, 2010 at 05:30 AM Pavel Pawlowski

I´ve tried with instance name, but no changes. Also tried changing default port of SQL 2000 to 1234 but still getting the same error.

My smartdevice cannot ping my PC, i need it to do it by ActiveSync since it´s a device without network card.

I think that´s my problem, but i cannot figure out how to solve this situation...
Dec 07, 2010 at 10:46 AM Malkav
(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first
  1. Do you have a mixed mode authentication enabled on the server? If not, you have to enable it as the connection string you are using is for s SQL server authentication mode.
  2. The server you are connecting is a default instance? If not and you are connecting to named instance, you have to include an instance name in the connection string to be able to access it.
  3. If you want to use trusted connection, then the connection string is: Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;User ID=myDomain\myUsername;Password=myPassword;. Taken from http://www.connectionstrings.com/sql-server. Again if connecting to named instance, the instance name has to be included.
more ▼

answered Dec 06, 2010 at 10:51 PM

Pavel Pawlowski gravatar image

Pavel Pawlowski
22.3k 9 11 21

(comments are locked)
10|1200 characters needed characters left

Problem solved!!

My mistake. I thought i was using SQL server SP4 but i checked and i wasn´t. Installing the servicepack solved everything.

Sorry for the inconvenience, and thank you for helping me.
more ▼

answered Dec 07, 2010 at 01:20 PM

Malkav gravatar image

Malkav
21 1 1 1

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x473

asked: Dec 06, 2010 at 01:05 PM

Seen: 1350 times

Last Updated: Dec 06, 2010 at 01:05 PM