Smart questions
Smart answers
Smart people
Join Tek-Tips Forums
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

moron3 (TechnicalUser) (OP)
13 Oct 11 14:29

When I use the Visual Studio 2010 Datasource designer to connect to my SQL server remotely everything works fine.  However, if I try to connect programatically from the same project using this code (sensitive info X'd out):

            SqlConnection conn = new SqlConnection();
            conn.ConnectionString = "Data Source=\"XX.XXX.XXX.XXX, 1433\";User ID=ASPNET;Password=XXXXXXXX";
            conn.Open();

 I get the following error:

{"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - The requested service provider could not be loaded or initialized.)"}

port 1433 is open on the remote network and like I said I can browse the server fine through datasource designer. I'm using the same connection string as the designer in my code.
 
jmeckley (Programmer)
13 Oct 11 16:22
the little bit you have here is correct. either there is a problem with the connection string, or the database is not configured to allow this type of connection.

google the error message and you will get plethora information which should help you debug the problem.

Jason Meckley
Programmer

FAQ855-7190: Database Connection Management
FAQ732-7259: Keeping the UI responsive

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close