質問

I am writing a .net cf 2.0 application on a Windows Mobile 6.1 machine. The machine was causing me a lot of trouble with wifi connections at first, but then it just worked for a while.

However, almost 10 days ago, the the machine stopped connecting to the sql server (on the same network) only while it's plugged in. Internet works fine though. When I unplug the machine it connects normally to sql server.

Any help would be appreciated. This problem is preventing me from debugging the application.

I tried a demo project to confirm this, here is the code:

    static void Main()
    {
        connection = GlobalFields.MainTableAdapter.Connection;
        GlobalFields.OrdersAdapter.Connection = connection;

        connection.Open(); // I get an SqlException with no details if the 
                           // machine is connected (probably caused by a timeout)

        Application.Run(new frmLogin());
    }
役に立ちましたか?

解決 2

I found the reason for the problem. It turns out that our network administrator installed a proxy server that periodically forces the handheld device to go through it, and then prevents it from accessing the the sql server on the network.

All I need to do is go to the network settings and disable the option to use the proxy server, then everything works fine.

他のヒント

So, the device connects to the SQL Server when the device is NOT docked, but fails to connect with the server when docked to a PC.

If I understand this correctly, I'd be looking at one of two things:

  • Either your account on the PC is locked out (expired password), or
  • A device setting tells it to connect through the PC when docked, but there is no current connection to the Server from the PC

Is there any chance that one of those two options is possible? Can you connect to the SQL Server from the PC using the same connection string?

EDIT: If this is a connection issue, try testing with different connection strings:

static void Main()
{
    #if DEBUG
    connection = "sqlserver://localhost;integratedSecurity=true;";
    #else
    connection = GlobalFields.MainTableAdapter.Connection;
    #endif
    GlobalFields.OrdersAdapter.Connection = connection;

    connection.Open(); // I get an SqlException with no details if the 
                       // machine is connected (probably caused by a timeout)

    Application.Run(new frmLogin());
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top