Friday, March 9, 2012

How can upload and connection my mssql database my site

I make a site in my computer it's work localhost I make mssql connection in localhost but ? don't know how i make mssql connection on website

This is a little hard to explain: But if mssql is installed on your development machine, then it makes sense that it would work, when you are testing in on localhost. That same database is most likely NOT installed on your web host. You didnt provide the details we would need to help you work through this issue but we may be able to walk you through getting it setup correctly...

Post your connection strings (minus any user names and passwords) and tell us if you are using a web host that includes an MSSQL or MSSQL-Express installation.

|||

? upload my mssql database from ftp my site i use that connection but don't work

data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\char.mdf;integrated security=true;user Instance=true"

|||

Thats a connection for an SQL Express Database, that exists inside your project, is uploaded and auto attached the first time the application is run.

I've never been able to get that to work on a webhost. It always seems to work just great in a development enviroment, but I dont think I've had a single time, across multiple hosting providers, that the attach method has worked without at the very least, some minor tweaking. Mostly thats because shared hosting enviroments get really funny about attaching databases.

I would contact your webhost. Make sure they have SQL Express 2005 running on the machine you are trying to run your site on. I would also ask them if there is a way that you can attach the file manually (through the Configuration Manager or the Management Studio Express 2005) and then we can modify your connection string to point to it.

Who is your web host?

|||

hi

i create my database on web host

and my connection string

New

SqlConnection("data source=server Catalog=database; User ID=username; Password=password; Integrated Security=True;")

but error

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 - Could not open a connection to SQL Server)

|||

This gets hard to troubleshoot at this point, because there are so many variables. Typically this is something you're going to be able to solve with the data source= section.

Good values if your application is running on the same server as the database will be

data source=localhost

data source=127.0.0.1

data source=(ip address of server)

But you may be in a shared hosting enviroment - which may have a shared database server, so you may need to specifiy an instance name as well. Have you contacted your hosting provider yet to try to resolve this issue?

No comments:

Post a Comment