附加信息:
尝试初始化 System.Data.SqlClient.SqlConnection 对象时出错。为连接字符串提供的值可能是错误的,或者它可能包含无效的语法。
我正在role
我的网络应用程序中创建新的。当我添加新角色时,我error
对它一无所知,请帮助我。
连接字符串:
<connectionStrings>
<add name="PayRollContext" connectionString="metadata=res://*/PayRollDataModel.csdl|res://*/PayRollDataModel.ssdl|res://*/PayRollDataModel.msl;provider=System.Data.SqlClient;provider connection string="data source=ATI_SHAH\SQLEXPRESS;initial catalog=PayRollManagmentSystem;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
Controller
我在这里得到一个错误:{var chkRole = Roles.RoleExists(rolename);}
public ActionResult CreatRole(aspnet_Roles role)
{
string rolename = role.RoleName;
if (ModelState.IsValid)
{
var chkRole = Roles.RoleExists(rolename);
if (chkRole == true)
{
ModelState.AddModelError("Name", "* Role Already Exist");
}
else
{
Roles.CreateRole(rolename);
return RedirectToAction("ListRole", "Role");
}
}
return View();
}