Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 06, 2008 01:54 AM by Eulador
Dec 27, 2007 08:08 PM|LINK
I recently started using databases/tables in my website and it was working perfectly on my local machine, however, when i uploaded it to the web, it now says the following error:
along with a stack trace. I looked into it, and, according to various forums, this is due to an invalid connection string, or if SQL server 2005 is set for "local only" connections. So, i downloaded SQL server 2005 and changed the setting from local only
to local/remote, then restarted it, and it still doesnt work. i am hosting my site through godaddy, so i dont see how if i change a setting for the server its going to make a difference, since my machine is not hosting the website or databases. however, im
still new at this so could someone point me in the right direction? im not sure what to do at this point, my website is basically complete (and works flawlessly on my computer) but obviously doesnt work online. thanks in advance.
AsP Net 2.0
.NET Runtime 2.0 Error
sql server 2005
Asp 2.0 Server
Dec 28, 2007 01:42 AM|LINK
What does your connection string on the server look like?
You need a local config file with a connection string that points to your local database. On your deployed site, you will have a different config file with a connection string that points to the database on the server.
Dec 28, 2007 04:38 AM|LINK
Thanks for the reply. My connection string for that database (club.mdf) looks like this:
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Club.mdf;Integrated Security=True;User Instance=True"
It was created automatically when i tried to add a table to the site, and VWD 2005 asked me if i wanted to create a connection string for that particular database. I believe it works ok, because on my local machine it connects properly, but again i am new
at this so correct me if im wrong.
Dec 30, 2007 02:05 AM|LINK
It may work on your local machine but the server has it's own database engine running.
You need to find the name of the database engine on the server: Data Source=.\SQLEXPRESS
And you need to know if the data file you are trying to connect to exists on the server and where it is: AttachDbFilename=|DataDirectory|\Club.mdf
Dec 30, 2007 02:46 AM|LINK
ok i see what you mean... but my connection string says just that.. it designates the name of the engine as .\SQLEXPRESS (i do have a database that i created on godaddy myself that is named database1, but that is different than \.SQLEXPRESS, correct? SQLEXPRESS
is the engine, not the database i created?) and it also gives the location of the database via the AttachDbFilename tag. I created another database (club.mdf) in the App_Data folder and used the connection string i provided, and it still doesnt work.
Dec 30, 2007 01:02 PM|LINK
If you've copied the database to the server, into the app_data folder, then it is probably the "instance" name of the server.
SQLEXPRESS is the engine, not the database i created
Right, they use the term "instance". Ask godaddy for the name (or it may be in a readme file or FAQ). It's not likely they are using Express.
Dec 31, 2007 04:38 AM|LINK
you should check whether your hosting supports .mdf files (SQL Server 2005 Express Edition). Most of the time it is not the case for shared hosting. They use SQL server and gives your username, password, and server address. and also they are not supposed
to let you use integrated security. the bottom line is, you probably need to use different connection string.
check out here for connection strings, that may help you:
Dec 31, 2007 06:49 AM|LINK
Thank you very much for your help steve, i really appreciate it!
I visited the FAQ page and it says to use sqloledb as the "DataSource", or instance as you said? So, i used the following connection string: (not sure if its 100% correct)
<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="Data Source=p3swhsql-v04.shr.phx3.secureserver.net;Data Source=.\sqloledb;Initial Catalog=database1;User ID=XXXXX;Password=XXXXX;" />
and it still says the same thing. Now obviously it is trying to connect to the server i created on godaddy, but does it really need to connect to that to work? I mean, what is the difference between a .mdf file i create in VWD 2005 and upload to the server,
or creating one on godaddy's control center (which by the way has a maximum of 1 that can be created)? Is there a security/performance difference between the two, or do you always have to have a server to connect to? i realized that when i created an SQLdataSource
(.MDF) in VWD 2005, it created the connection string automatically (to the app_data folder). So if i created a brand new database (MDF) and had VWD create the strings for me, it should work right (as long as the string is correct and the data is indeed on
the server)? But it doesnt for me... i dont understand.. shouldnt it be godaddy fault then (for a faulty setting in the asp engine?) or not?
Dec 31, 2007 06:03 PM|LINK
So if i created a brand new database (MDF) and had VWD create the strings for me, it should work right (as long as the string is correct and the data is indeed on the server)?
Lets say you live in a small town and have a list of directions to get to a liquor store.
If you the moved to a different town, would that list of directions work? No.
The same with your connection string. The connection string on your local box is only good there. Ask GoDaddy for a sample connection string.
Dec 31, 2007 07:51 PM|LINK
Here is the actual connection string I use on a godaddy account...
Data Source=p3swhsql-v04.shr.phx3.secureserver.net;Initial Catalog=DB_xxxxxxxxx;User ID=xxxxxxxxx;Password=xxxxxxxxxxxx
where 'Catalog' is the name of the database it gave you when it was created. It will probably start with 'DB_'.
User ID is your godaddy ID, Password is your password...