0
首先根據登錄用戶獲取角色名稱。之後,根據角色從數據庫中獲取功能代碼。我需要將sql
結果分配到Array
,但保持顯示錯誤can't convert from string to string[]
如何分配值到C#中的數組#
public override string[] GetRolesForUser(string username)
{
DEV_Context OE = new DEV_Context();
string role = OE.UserRefs.Where(x => x.UserName == username).FirstOrDefault().RoleName;
string[] permission = OE.RolePermissionRefs.Where(x => x.RoleName == role).FirstOrDefault().FunctionCode;
string[] result={permission};
return result;
}
你爲什麼不只是返回許可; ?此外,我建議你使用Collection-Types而不是數組。所以例如列表 –
Jannik
2014-10-30 06:30:24