这是我用来连接LDAP的代码
using (DirEntry = new DirectoryEntry(string.Format("LDAP://{0}/{1}", this.Host, ServerName)))
{
DirEntry.RefreshCache();
if (!string.IsNullOrEmpty(UserName))
{
DirEntry.Username = UserName;
DirEntry.Password = PassWord;
}
if (DirEntry.Properties.Contains("objectGUID"))
{
byte[] guiddatet = (byte[])DirEntry.Properties["objectGUID"].Value;
return new Guid(guiddatet);
}
Run Code Online (Sandbox Code Playgroud)
运行代码时出现"服务器无法运行"错误消息.
有人可以告诉我,我做错了.无论如何要用直接LDAP查询替换上面的代码.
我在字符串变量中有一个Url.
我所拥有的Urls的示例格式是:
http://something.com/sites/collection
Run Code Online (Sandbox Code Playgroud)
http://something:33/sites/collection,
something:44/sites/collection
现在我想从该URL中提取"/ sites/collection"部分.
如何在Sql中将BIT数据类型转换为Varchar?
我试过CAST
CAST(IsDeleted as Varchar(512))
但它不起作用....
注意:IsDeleted是BIT数据类型,我需要将其转换为Varchar或Int