小编Meh*_*ard的帖子

如何以字符串格式检索sql server SID?

你好我今天早上试图用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() ;
Run Code Online (Sandbox Code Playgroud)

非常感谢

sql sid bytearray converter

2
推荐指数
1
解决办法
5793
查看次数

如何检查 radComboboxItem 'CheckBox'?

我对图书馆“Telerik”有一点问题。事实上,我想实现一个带有'checkBox'的'RadCombobox'。它运行良好,但是当我想要'Check'一个项目时,这是不可能的?!这是我的示例代码。我更改了属性'selected'的属性但是不幸的是,它没有选中“已选中”框.....

非常感谢您的回答!

<!-- language: lang-cs -->

//Define the sqlAdaptater for binding source

System.Data.SqlClient.SqlDataAdapter myBinding = new SqlDataAdapter("SELECT [name] FROM [dbo].[tblProcess] WHERE [currentVersion] = 1 AND [deleted] = 0 AND [parent] = 0",connectionString);

DataTable links = new DataTable();

myBinding.Fill(links);

//Set the attributs of RadCombobBox

RadComboBoxSelectedEntity.DataTextField = "name";
RadComboBoxSelectedEntity.DataValueField = "name";
RadComboBoxSelectedEntity.DataSource = links;

//Not working..its selected but not checked ?
RadComboBoxSelectedEntity.SelectedIndex = 1;

//Not exist ?? -> 
RadComboBoxSelectedEntity.CheckedIndex = 1;
Run Code Online (Sandbox Code Playgroud)

c# checkbox telerik radcombobox

1
推荐指数
1
解决办法
2994
查看次数

无法在c#中初始化列表集合?

您好我不知道为什么我不可能完成之前声明的对象集合.

这是我的声明一个对象列表的列表.(我想将对象列表存储在引用列表中):

private List<List<Classes.instancedModel>> listInstance;
Run Code Online (Sandbox Code Playgroud)

我在构造函数中初始化

listInstance = new List<List<Classes.instancedModel>>();
Run Code Online (Sandbox Code Playgroud)

我在循环中完成列表之前初始化列表的第一个数组,但我不能......

listInstance[0] = new List<Classes.instancedModel>();
listInstance[0].Add(new instancedModel(1, position_model_origin, new Vector3(0, 0, 0), 1, Game));
Run Code Online (Sandbox Code Playgroud)

但是我会抛出类型的异常:ArgumentOutOfRangeException

有人可以向我解释如何声明两个动态列表并填充飞行作为我的例子吗?将列表放入列表中

.net c# arrays list multidimensional-array

1
推荐指数
1
解决办法
118
查看次数

如何使用数字正确地对列表<string>进行排序?

我遇到了难以对包含数字的列表项字符串进行排序.我希望我可以自动从最小到最大排序.这是我的代码:

// Initialize an array to store the numbers
List<string> tab_num = new List<string>();
tab_num.Add("A.3.2.1");
tab_num.Add("A.3.3.1");
tab_num.Add("A.1.0.1");
tab_num.OrderByDescending(num => num).ToList();
Run Code Online (Sandbox Code Playgroud)

为什么我的结果是假的?...

[1] A.3.2.1

[2] A.3.3.1

[3] A.1.0.1
Run Code Online (Sandbox Code Playgroud)

预期结果:

[1] A.1.0.1

[2] A.3.2.1

[3] A.3.3.1
Run Code Online (Sandbox Code Playgroud)

非常感谢

.net c# linq sorting

-2
推荐指数
1
解决办法
5293
查看次数