Friday, February 24, 2012

Connection String Problem : Quantasoft !

Hello ! i just thought to give it a try to see if it works or not!, i made a webpage inC# and it worked fine on my computer but when i uploaded on the internet i got error !!.- SERVER "/" error - runtime error .!!!. then I tested it without any database and found it to work fine ! but when i do any database connectivity my webpage gives errors on the internet !!.. So i got that there is a PROBLEM IN CONNECTION STRING.

Here is what i did!...... I right-clicked the APP_DATA and added a DATABASE named TEST.MDF. Then i added a TABLE named TEST in TEST.MDF and added some fields. Then i dragged the table to the designer view and thus it created a GRIDVIEW and a SQLDATASOURCE1. Thats it !!. it showed all the fields when i ran it on the computer by pressing F5. !!

Everything Ran fine on my computer ! but when i uploaded the website on the internet it showed runtime errors !!

I created a FREE account in Quantasoft web hosting and they had a condition that says -"MS SQLServer2005 Express Edition only User Instances"- I DONT KNOW WHAT IT MEANS !! so i carried on with the uploading stuff !. after uploading i read that the database should be in the APP_DATA folder and i did it !. then it was written to put my database name and it generated a connection string which was-THIS IS WHAT THEY GAVE ME =:<add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;Database=abcd.qsh.in_5f2a2114-ebeb-4252-463a-6b1f8cfc3f14;AttachDBFilename=|DataDirectory|test" /> . BUT i had a different connection string ! and that was -THIS IS WHAT I HAD ALREADY->><addname="testConnectionString1"connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\test.mdf;Integrated Security=True;User Instance=True"providerName="System.Data.SqlClient"/> So i deleted my connection string and replaced it with this string ! but still it didnt worked !!.

WHAT DO I NEED TO DO !? HELP ME.
PLEASE TELL ME HOW TO CONVERT MY CONNECTION STRING !
I also found out one more post relating to my problem please read it because somebody replied about some ASPNETDB i also dont know about aspnetdb!! -http://forums.asp.net/t/1122922.aspx

Also, i viewed some starter kits and they also had a ASPNETDB.mdf and someother.mdf in their APP_DATA folder ! . what is ASPNETDB ??.. Do i also need it ? where do i make it or get it !? please explain all about this! i dont know anything about this !

Thanks in advance.

Hi ashutosh508,

ASPNETDB is introduced from asp.net 2.0 and is used to manage profiles/membersips/roles/etc, you can access it from your web site administration tool. Generally speaking, if you do not implement profiles/membership/roles features in your application, you do not need to build this database(actually this database can also be build automatically).

THIS IS WHAT THEY GAVE ME =:<add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;Database=abcd.qsh.in_5f2a2114-ebeb-4252-463a-6b1f8cfc3f14;AttachDBFilename=|DataDirectory|test" /> . BUT i had a different connection string ! and that was -THIS IS WHAT I HAD ALREADY->><addname="testConnectionString1"connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\test.mdf;Integrated Security=True;User Instance=True"providerName="System.Data.SqlClient"/>

I think your connection string is correct and the one they provided you is wrong. Based on my understanding, since we have specified to use AttachDBfile automatically, we cannot specify theDatabase name--actually i think the database name will be generated automatically after the database file(mdf) is attached.

Any way, you need to consult your web hosting company for more details. Hope my suggestion helps

No comments:

Post a Comment