The current scenario before i start asking my question
-
A C# Winforms application needs to be deployed on our LAN.
-
The network contains 200+ computers running Windows XP (& above) having the same domain/workgroup.
-
Unfortunately, there’s still some mixups and IP conflicts throughout the network.
-
The network still works !!… (ahem..)
-
A central server (with unique name & IP) hosts the database (SQL Server 2008 R2)
-
The application has a provision to specify the connectionstring on the client machine
-
The application validates this string (open > close connection else exception) and stores in a local file.
Now, My problem is that…
The application connects successfully to the server (open > close connection) during the checking phase, but fails when there’s actual datasets are to be fetched from the server.
- Which is the most reliable way to address the server in the connection string in this mixed up scene ?
This holds true even if i use the “sa” account, i have used machine name / IP to address the server
When you say your application “fails when there’s actual datasets are to be fetched”, what do you mean? What’s the error? Encapsulate your
SqlDataAdapter.Fill()method in a try catch block and out that error to a log or the GUI for quick debugging purposes. What does the error say? Is it a network or instance related issue..?The application connects successfully to the server
Are you talking about the server as a physical machine, or are you talking about the SQL Server instance that houses the database you are trying to connect to?
Here’s a big “gotcha”. If you are using a named instance, then you need to make sure that the SQL Server Browser service is running on the server that houses the SQL Server instance(s). That is the service that, when reached out over port 1434, tells the application what dynamic port the named instance is listening to.
Also, your connection string could have some issues in it.
Long story short, it is almost impossible to tell what your problem is with the very little given information. It is all just guessing troubleshooting here. Please give me more information.
Edit: if you have a DHCP/DNS server on your network, then I don’t see why you should be getting “messed up” workstation network issues, at least with IP assigning and name resolution. Your workstations need to be able to resolve the server name to reach it. But it doesn’t sound like that’s your issue.