【发布时间】:2012-09-03 04:57:05
【问题描述】:
您好,自从今天早上尝试使用 SQl 查询检索我的计算机的 SID 时,我就崩溃了。 我只能在 Byte 数组中检索 SID!
是否可以通过强制转换检索字符串?我试过了,但做不到。
这是我的 sql 查询
SqlDataSource data = new SqlDataSource(
System.Configuration.ConfigurationManager.ConnectionStrings["myDbConnection"].ToString(),
"Select sid FROM sys.server_principals where Name='##MS_SQLAuthenticatorCertificate##'");
DataView viewData = data.Select(DataSourceSelectArguments.Empty) as DataView;
//Get S.I.D in byte
byte[] tabSid = (byte[]) viewData[0][0] ;
//Get S.I.D in String format (not working)
string varSid = viewData[0][0].toString() ;
非常感谢
【问题讨论】:
标签: sql bytearray converter sid