下面是我正在使用的代码,但它回复了
方法'Boolean isUser(System.String)'没有支持的SQL转换.
有帮助吗?顺便说一句,我正在使用linq到SQL数据源
public void dataBind()
{
using (var gp = new GreatPlainsDataContext())
{
var emp = from x in gp.Employees
let k = isUser(x.ID)
where x.ActivtyStatus == 0
&& isUser(x.ID) != false
orderby x.ID
select new
{
ID = x.ID,
Name = x.FirstName + " " + x.MiddleName
};
ListView1.DataSource = emp;
ListView1.DataBind();
}
}
public static bool isUser(string ID)
{
int temp;
bool x = int.TryParse(ID, out temp);
return x;
}
Run Code Online (Sandbox Code Playgroud)
我找到了一个解决方案来查询第一个查询的结果作为对象,但这是一个很好的原因,我将通过我的数据两次.
根据Anders Abel的建议使用之后最终工作的更新代码
public …Run Code Online (Sandbox Code Playgroud) 我是新手访问Active Directory,我被建议使用,System.DirectoryServices.AccountManagement但我找不到initials变量任何帮助?
所以在过去,我曾经使用过Windows 8中没有的System.Security.Cryptography.我在Windows 8中找到的是windows.security,但我没有找到任何关于如何使用Sha256键的示例.这是我在System.Security.Cryptography中使用的旧代码
string appID = "appid";
string key = "password";
var hmacsha256 = new HMACSHA256(Encoding.Default.GetBytes(key));
hmacsha256.ComputeHash(Encoding.Default.GetBytes(appID));
string k = "";
foreach (byte test in hmacsha256.Hash)
{
k += test.ToString("X2");
}
Run Code Online (Sandbox Code Playgroud)