what is the connection string to connect sql server with asp.net? - asp.net

I need what are all the connection string wanted to connect database server (SQL Server 2005)
example server name, password, username like wise, I don't know how to connect ASP.NET with SQL Server 2005 database - give me a perfect connection string to connect.
Thanks.

http://connectionstrings.com/sql-server-2005#p1

Related

Remote connection to SQL Server - Asp.net MVC

I'm currently setting up a remote SQL Server. Made all steps regarding remote connection (as found on http://blog.citrix24.com/configure-sql-express-to-accept-remote-connections/).
Let's say my servers are :
WEB
SQL
I can connect from WEB, using SQL Server Management Studio, to my SQL Server using my connection string. Using the same connection string in my web.config does not work, keep getting error 26 - Error locating server.
Connection string:
Data Source=169.254.196.1,1433;Initial Catalog=MyDb;User ID=myuser;Password=mypassword
Any ideas?

Connect to a database instance with many instance on the net

I tried to connect to a SQL Server database on the internet via an Asp.net application that is on my local system.
The database is on a server with IP x.x.x.x and on the server we have 3 instances of SQL Server 2005: instance1/MSSQL2005 and instance2/MSSQL2005 and instance3/MSSQL2005.
I can't connect with my application to the instance1/sqlserver2005 on the database XXX on this instance !
This its my connection string that didn't work :
<add name="VestaWSEntities"
connectionString="metadata=res://*/DBModel.csdl|res://*/DBModel.ssdl|res://*/DBModel.msl;provider=System.Data.SqlClient;provider connection string="server = x.x.x.x ;Data Source=Instance1\MSSQL2005;Initial Catalog=MyDB ;User ID=sa;Password=123;MultipleActiveResultSets=True""
providerName="System.Data.EntityClient" />
Your instance names don't look correct.
Usually a SQL instance is specified in the format server\instance
given the information in the question, it should be something like
x.x.x.x\instance1
x.x.x.x\instance2
x.x.x.x\instance3
Can you connect to the instances in SSMS? You should use the same value in the data source in your connection string
Try replacing this in your connection string
server = x.x.x.x ;Data Source=Instance1\MSSQL2005;
to this
Data Source=x.x.x.x\instance1;Initial Catalog=MyDB;

Is there anyway to connect to local SQL Server database from hosted website?

I create a website with a SQL Server database and put it on a host ...
I just want to know if there is a way that when I open my website on a special PC, I could connect to the PC's SQL Server database for reading and writing ...
Let me know if there is a special connection string for that !
You need to use server IP address and user id , password for connect to database.
Like
<add name="DefaultConnection" connectionString="Data Source=198.0.0.1;Initial Catalog=Database;user id=user1;password=[system];" providerName="System.Data.SqlClient" />
IP - 198.0.0.1
User id - user1
password - [system]
Note -
When you accessing your database from other computer , windows
authentication will not work.
Set sql server authentication in sql server
Allow remote connections to sql server
Allow Sql server port into firewall
Then try.

Not able to connect to the SQL Server data from asp.net app

We are upgrading from an environment where the development web server, the SQL Server 2005, and SQL Server data are all on the same machine, a Windows XP Machine. We are upgrading to having the web server on one Windows 2008 server, the SQL Server on a 2nd Windows 2008 Server, and to Server to a Windows 2008 server, nd the data on a SAN.
Now we are getting the error message:
A connection was succesfully established with the server, but then
an error occured during the login
process. (provider: named pipes
provider, error 0, no process is on
the other end of the pipe.)
The network guy thinks it is a problem with the connection string:
<add name="CNString"
connectionString="Data Source=WEBSERVER;
Initial Catalog=PCIdb;
User ID=sa;Password=pass;"
providerName="System.Data.SqlClient"/>
Can anyone help out here?
Is your SQL Server really called WEBSERVER (DataSource="WEBSERVER") ??
Also, I would never EVER use the sa account in a connection string - NEVER, period. Use an application specific user or something, but do not use the sa account under any circumstances.
This can be caused by any number of reasons, but the first thing to look at is the configuration and setup of the SQL Server itself.
Are named pipes enabled on the server? You can check this through the server configuration manager (on the SQL Server machine itself).
Is the user on the connection string (or the connection pool user if you are using SSPI) setup on the server?
Note:
I do hope the connection string you put up is an edited version of your real one, as there are a couple of issues with it:
Using the sa login - you should never do that as now any SQL exploit can do any damage it wants
Calling a sql server "webserver" - a really confusion naming decision
When it comes to connection strings, look at connectionstrings.com - they hold a good list of valid connection strings to many databases using different providers.
I got that error before...Make sure SQL server services are started
If that's not it, change the authentication mode to both server and windows.
It could be a connectionstring problem. Try comparing your connectionstring to the connectionstrings at http://www.connectionstrings.com but it could also be that the remote connection or the remote server (the webserver in this case) isn't allowed to connect to SQL.
Check if remote connections are allowed and named pipes and/or TCP/IP protocols are enabled on the database server.
But, based on the scenario you've described, I'd say it's the database-end that's refusing the connection (since you've already had a working solution).

I can't display my pages on ASP.NET

I'm developing a web site with asp.net on localhost, I'm beginner. I wrote a login page and it
works well. However when I click a link, the server can't load the page and gives this 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Any idea?
This means you either:
provided the wrong login/password for SQL while using SQL authentication
have used Windows authentication for SQL but the user that your web app is running as doesn't have a login
have provided the wrong connection details for the sql instance so it can't be found
don't have remote connections enabled for that SQL server instance
Are you using SQL server? If yes, run a debug and see what is the connection string at run time and whether you can connect to the DB using the connection string.
In case you are not using SQL server, it seems, you have extended the membership provider but not done so for the role provider. The default role provider tries to connect to SQL Server instance.

Resources