本文介绍了在webconfig中设置连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好......
我在并行plesk中使用sqlserver2008,我使用用户名[moshavercity]和我的webconfig文件connectionstring属性创建数据库为[bongah],如下所示:
Hi there...
I m using sqlserver2008 in parallel plesk,i create database as [bongah] with username [moshavercity] and my webconfig file connectionstring attribute as below:
<connectionStrings>
<add name="bongahConnectionString" connectionString="Data Source=.\SqlExpress;Initial Catalog=bongah;
User Id=moshavercity; Password=mehdi1363224MEH1363"
providerName="System.Data.SqlClient" />
</connectionStrings>
但当我尝试登录db时出现此错误
but when i try to login to db this error appear
Login failed for user 'moshavercity'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'moshavercity'.
Source Error:
Line 78: {
Line 79: SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["bongahConnectionString"].ToString());
Line 80: con.Open();
Line 81: str
我该如何解决这个问题问题,请
how can i fix this problem,please
推荐答案
这篇关于在webconfig中设置连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!