473,761 Members | 9,477 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error in remote connection to SQL Server

Hi. I am having an problem connecting to a remote SQL Server. Other
applications (using access) are connection to it but I cannot get it
to work through ASP.Net.

Here is my connection string:

Public Function StringConnectio n() As String
Return "Server=myserve rname;Database= mydatabasename; User
ID=myid;Passwor d=mypassword;"
End Function

Everything works fine if I use my local DB so I am sure it's not the
code and other applications can connect to the server so I am pretty
sure it's not SQL Server, something must be wrong in the connection
string. The sample above is just the latest version I've tried. I'm
only posting it in the hope that someone can show me the correct
string for a remote connection.

Any ideas?

Thanks,
Steve
Dec 13 '07 #1
4 1573
You'd be a lot better off if you didn't hard-code the connection string into
your compiled code. Better to use the app.config / web.config
ConfigurationMa nager.Connectio nStrings["myConnectionSt ring"].ConnectionStri ng
or an <appSettingssec tion instead. This makes your application more
portable.

If, as you say, other applications can connect to the server ( i assume
remotely) then why don't you take a look at their connection strings?
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"gl****@yahoo.c om" wrote:
Hi. I am having an problem connecting to a remote SQL Server. Other
applications (using access) are connection to it but I cannot get it
to work through ASP.Net.

Here is my connection string:

Public Function StringConnectio n() As String
Return "Server=myserve rname;Database= mydatabasename; User
ID=myid;Passwor d=mypassword;"
End Function

Everything works fine if I use my local DB so I am sure it's not the
code and other applications can connect to the server so I am pretty
sure it's not SQL Server, something must be wrong in the connection
string. The sample above is just the latest version I've tried. I'm
only posting it in the hope that someone can show me the correct
string for a remote connection.

Any ideas?

Thanks,
Steve
Dec 13 '07 #2
If you are using the "Web Site" project model, you need to place all your
global.asax code in global.asax.cs, in the App_Code directory

You must include this at the top of global.asax.cs :

public class Global : System.Web.Http Application

.....and include this directive in global.asax :
<%@ Application Language="C#" CodeBehind="Glo bal.asax.cs" Inherits="Globa l" %>

the same for vb :
<%@ Application Language="VB" CodeBehind="Glo bal.asax.vb" Inherits="Globa l" %>

With a Web Application Project, this is not necessary and you can use the
normal (like in 1.1 that is) codebehind deal.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"gl****@yahoo.c om" wrote:
Hi. I am having an problem connecting to a remote SQL Server. Other
applications (using access) are connection to it but I cannot get it
to work through ASP.Net.

Here is my connection string:

Public Function StringConnectio n() As String
Return "Server=myserve rname;Database= mydatabasename; User
ID=myid;Passwor d=mypassword;"
End Function

Everything works fine if I use my local DB so I am sure it's not the
code and other applications can connect to the server so I am pretty
sure it's not SQL Server, something must be wrong in the connection
string. The sample above is just the latest version I've tried. I'm
only posting it in the hope that someone can show me the correct
string for a remote connection.

Any ideas?

Thanks,
Steve
Dec 13 '07 #3
http://www.connectionstrings.com/

<gl****@yahoo.c omwrote in message
news:85******** *************** ***********@d4g 2000prg.googleg roups.com...
Hi. I am having an problem connecting to a remote SQL Server. Other
applications (using access) are connection to it but I cannot get it
to work through ASP.Net.

Here is my connection string:

Public Function StringConnectio n() As String
Return "Server=myserve rname;Database= mydatabasename; User
ID=myid;Passwor d=mypassword;"
End Function

Everything works fine if I use my local DB so I am sure it's not the
code and other applications can connect to the server so I am pretty
sure it's not SQL Server, something must be wrong in the connection
string. The sample above is just the latest version I've tried. I'm
only posting it in the hope that someone can show me the correct
string for a remote connection.

Any ideas?

Thanks,
Steve

Dec 13 '07 #4
A remote server must be enabled to receive remote connections.

This is via the "Sql Server Surface Area Configuration".

if that is setup properly, there are 2 things.
www.connectionstrings.com

keeping playing with them.

and (default)....th e port is 1433..you have to make sure this is open...via
a firewall program you are using.


<gl****@yahoo.c omwrote in message
news:85******** *************** ***********@d4g 2000prg.googleg roups.com...
Hi. I am having an problem connecting to a remote SQL Server. Other
applications (using access) are connection to it but I cannot get it
to work through ASP.Net.

Here is my connection string:

Public Function StringConnectio n() As String
Return "Server=myserve rname;Database= mydatabasename; User
ID=myid;Passwor d=mypassword;"
End Function

Everything works fine if I use my local DB so I am sure it's not the
code and other applications can connect to the server so I am pretty
sure it's not SQL Server, something must be wrong in the connection
string. The sample above is just the latest version I've tried. I'm
only posting it in the hope that someone can show me the correct
string for a remote connection.

Any ideas?

Thanks,
Steve

Dec 13 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2198
by: deltalimagolf | last post by:
I now get the following error message after copying an asp.net application to the deployment web server. I don't have SQLExpress or any version of SQL 2005 installed. I found the "LocalSQLServer" connection string in the machine.config, changed that to look at a SQL 2000 database, but the error still comes up. An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be...
0
3714
by: ruju00 | last post by:
I am getting an error in Login() method of the following class FtpConnection public class FtpConnection { public class FtpException : Exception { public FtpException(string message) : base(message){} public FtpException(string message, Exception innerException) : base(message,innerException){}
1
4728
by: John Shadel | last post by:
I have the following setup: 1. ASP.NET 2.0 web app hosted on a web server (inetpub directory hosting physical files of the web site on a different drive name, E: than the SQL Server Instance, which is on C:) 2. SQL Server on the same server, with security settings enabling ASPNET group and groups containing users allowed to interact with the website added to SQL Server Instance security settings. 3. Impersonation = true, i.e. ASPNET...
5
1939
by: James | last post by:
Hello, I have written a simple logon page that redirects to another page when successful. All works fine on my computer but when I upload it I get the error message below. I have written it in ASP.net v2, and have put it on IIS v6 on windows server 2003. I think it may be something to do with connection string to the database,
1
7050
by: NEWS | last post by:
My application is giving error .pls help . error : Server Error in '/webpdms' Application. -------------------------------------------------------------------------------- An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40...
8
4369
by: =?Utf-8?B?U3JpcmFtIE1hbGxhanlvc3VsYQ==?= | last post by:
Hi, I am not sure whether this is the correct newsgroup where I need to post my question. Let me know where I need to post for a quick response. I get the following error when I try to connect to SQL 2005 from my ASP.Net 2.0 application. System.Web.Services.Protocols.SoapException: Server was unable to process request. ---System.Data.SqlClient.SqlException: An error has occurred while
5
2542
by: Alan Silver | last post by:
Hello, Server configuration: Windows 2003 Server SP2 SQL Server 2000 SP4 ..NET v2.0.50727 just built up a new server using the same configuration as my current one. I even used the same CDs and registration keys, so I'm certain that the two machines are as similar as they can be.
0
2006
by: aboutjav.com | last post by:
Hi, I need some help. I am getting this error after I complete the asp.net register control and click on the continue button. It crashed when it tries to get it calls this Profile property ((string)(this.GetPropertyValue("Address1")));
5
3558
by: Cirene | last post by:
I just deployed my new ASP.NET (3.5 FW) site to the hosting company I'm using, webhost4life. NOTE: I HAVE deployed other SQL Server sites to the same account with no issues. Now I'm getting this error. Any idea why? Server Error in '/myuser4/MyWebApp' Application. --------------------------------------------------------------------------------
13
3330
by: AAaron123 | last post by:
I downloaded the personal website starter kit and when I run it I get the error shown below. I found a way of using Launch Surface Area Configuration that is supposed to fix the remote setting but I tried it and still get the error. I do not have SQL Server 2005 installed (thought I did once). I do have SQL Server 2008 installed. I don't see anywhere in the code where SQL Server 2005 is referenced.
0
9988
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9923
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9811
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3911
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.