Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

Error in remote connection to SQL Server

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
glbdev@yahoo.com - 13 Dec 2007 16:18 GMT
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 StringConnection() As String
     Return "Server=myservername;Database=mydatabasename;User
ID=myid;Password=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
Peter Bromberg [C# MVP] - 13 Dec 2007 18:04 GMT
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  
ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString
or an <appSettings> section 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 

> 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
[quoted text clipped - 18 lines]
> Thanks,
> Steve
Peter Bromberg [C# MVP] - 13 Dec 2007 18:16 GMT
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.HttpApplication

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

the same for vb :
<%@ Application Language="VB" CodeBehind="Global.asax.vb" Inherits="Global" %>

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 

> 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
[quoted text clipped - 18 lines]
> Thanks,
> Steve
Jeff Dillon - 13 Dec 2007 18:26 GMT
http://www.connectionstrings.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
[quoted text clipped - 18 lines]
> Thanks,
> Steve
sloan - 13 Dec 2007 18:52 GMT
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)....the port is 1433..you have to make sure this is open...via
a firewall program you are using.

> 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
[quoted text clipped - 18 lines]
> Thanks,
> Steve

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.