Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 25, 2012 09:47 AM by Decker Dong - MSFT
Jan 23, 2012 04:49 PM|LINK
i have set up a new hosting account with a provider (godaddy) and i opened the website in visual studio.
i right clicked on the project and did an "add new item" and added a sql database (.mdf file) into the App_Data folder
i created a table and added some data. all is well.
i dragged and dropped a sqldatasource object onto a form and selected my database as the datasource
i can step through and even test my sql and it returns the right data
i can also see that VS automatically altered the web.config to now include my new connectionstring
so why is it....when i access my site over the web.....as soon as the page tries to access the database, it spins and spins and i get:
here's my web.config entry:
<add name="Dental" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Company.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
Jan 23, 2012 06:44 PM|LINK
Just Change the Permission for the App_Data from Read only to Read/Write and apply to all subfolders.
This should fix the issue..
Jan 23, 2012 06:50 PM|LINK
i guess....since this is a hosted account....i'll have to get the host to change the permissions on the app_data folder.
i do see that it is read only (so why doesn't my initial page load which only reads data from the database?)
seems like this would be a very common issue.
also......i have another site that uses a sql2005 databased stored on another machine
i copied the connectionstring over to this new site and received the same error - so that kinda rules out the "app_data" read/write thingy
Jan 23, 2012 06:56 PM|LINK
Firstly, to change the permission you do not need to contact the hosting provider you can change the permission by yourself.If you have access to the control panel.
The initial Page only reads data so thats why u can display the data but when you try to access the db i.e, for any CRUD then you cannot acess the DB.
Why are you storing it in App_Data you can use SQL rite?
Now, About your other website which uses SQL2005, Check the UserName and Password for the SQLServer The error which you are incurring is a common error as you might have noticed.
This can be caused by any or all the above mentioned things..
Jan 23, 2012 08:05 PM|LINK
now i'm really confused.....
i went to my godaddy control panel and added a database and set it all up
then back to visual studio and selected my sqldatasource control and configured it. in the drop-down list i saw the new database i had created
so i know it recognizes it.
but once again....over the net........it fails with the same error as above
Jan 23, 2012 08:13 PM|LINK
This a VS Project rite and also did you delete all the old files on godaddy and published the new files on the hosting account rite?
Sometimes as you might know the web.config might not have got overridden with the chnages specified so just try to publish the project after all previous files.
Also check this post
Jan 24, 2012 02:27 AM|LINK
Please refer to our
post. But, I would recommend you to contact your hosting provider to fix it. :)
Jan 25, 2012 09:47 AM|LINK
This problem is too generic，and there are quite a lot of things that may cause this kind of problem……As far as I see，you should create a connection from Vs by "View"=>"Server Explorer" and make a connection there，and then copy the connection string from
the right-down property panel and paste it into the web.config。