I am trying to host an Asp.Net website with a database. It's giving me an error, of can't open the database
I have tried to change the connection string but to no avail.
This is the connection string:
<connectionStrings>
<add name="WebSqlConnectionString"
connectionString="Data Source=MXOLISI\MSSQLSERVER2;,1432 ;database=NCEDA2014;User ID=NCEDA14;Password=7n63rDYtp38Ymfd;"/>
</connectionStrings>`
I expect for the webpage to open the default page
As the error clearly says your connection string has a wrong format.
<connectionStrings>
<add name="WebSqlConnectionString" connectionString="Data Source=MXOLISI\MSSQLSERVER2,1432;
database=NCEDA2014; User ID=NCEDA14;Password=7n63rDYtp38Ymfd;"/>
</connectionStrings>
You placed port number after semicolon which is not correct, it should be after server name.
Try these steps first:
Open SQL server and try to access the database with the credentials mentioned in the config file. If it works fine, follow next step.
Check your connection string. Use below code as you are having issue in your connection string:
<add key="myConnectionString" value="server=localhost;database=myDb;uid=myUser;password=myPass;" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.