Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
I am trying to develop an application that runs sql scripts either or on a local or on a remote sql server to update values on the application. The connection status is checked using:
 
TcpClient client = new TcpClient(serverName, 1433);
 
Once we know that we can listen using the port, I will have to pass the login credentials to the SQL server either using Windows/SQL server authentication. But the problem is that the application needs to determine if the server it is connecting to is local or remote based on which the functionality of the application can vary.
e.g: Use integrated security if using local windows authentication.
 
Can anyone please assist me in as to how I would be able to determine if the connection is remote or local as based on this my application can be developed to enable different functionality/properties.
 
Thank you.
Posted 30-Jan-13 6:24am
Comments
PIEBALDconsult at 30-Jan-13 13:11pm
   
Why would you not be using the ADO.net classes?
Member 9557085 at 30-Jan-13 13:58pm
   
The connection to the databases are made using the ADO.net classes where I am providing the connection settings. I tried using the ADO.net classes to rectify this problem as well but with no success. If you think its possible to achieve this using ADO.net classes please do let me know. Thanks..
PIEBALDconsult at 30-Jan-13 14:30pm
   
Then what is the problem? If it's database-related then ADO.net should work.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You wouldn't normally do this. At install time, you'd ask the person installing the app for the name of the SQL Server and instance, port number, and credentials to use, giving them the option of using Windows Authentication. You'd then construct the connection string from that information and test the connection if required.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 910
1 OriginalGriff 508
2 thatraja 225
3 Abhinav S 218
4 Emre Ataseven 200
0 Sergey Alexandrovich Kryukov 8,142
1 OriginalGriff 4,665
2 Peter Leow 3,774
3 Maciej Los 3,515
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 30 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid