会员创建角色
MemberShip Create Role
附加信息:
An error occurred while attempting to initialize a
System.Data.SqlClient.SqlConnection object. The value that was
provided for the connection string may be wrong, or it may contain an
invalid syntax.
我正在我的 Web 应用程序中创建新的 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();
}
其中的其余数据(元数据等)只是令人困惑 SQL 服务器。
<add name="PayRollContext" connectionString="data source=ATI_SHAH\SQLEXPRESS;initial catalog=PayRollManagmentSystem;multipleactiveresultsets=True;integrated security=True;App=EntityFramework">
附加信息:
An error occurred while attempting to initialize a System.Data.SqlClient.SqlConnection object. The value that was provided for the connection string may be wrong, or it may contain an invalid syntax.
我正在我的 Web 应用程序中创建新的 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();
}
其中的其余数据(元数据等)只是令人困惑 SQL 服务器。
<add name="PayRollContext" connectionString="data source=ATI_SHAH\SQLEXPRESS;initial catalog=PayRollManagmentSystem;multipleactiveresultsets=True;integrated security=True;App=EntityFramework">