数据GridView值列表 [英] Data GridView Value List

查看:92
本文介绍了数据GridView值列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个3列的表格.它包含行数.最后一列的值取自包含一对可能值的第二列.我想用包含来自第二列的值对的组合框填充第三列.对于不同的列,此值对将有所不同.我设法编写了一个查询,但它为所有行填充了相同的值列表.

表结构

I have a table with 3 columns. It contains numbers of rows. The value of last column is taken from second column which contains a Pair of possible values. I want to populate the third column with a combobox containing the value pair from second column. This value pair will be different for different column. I managed to write a query but it populates the same value list for all the rows.

table structure

PS_CODE        PS_PARAM    PS_VALUE
  A               Y;N          Y
  B               0;1          1



当某个时间在网格上填充此值时,我想将Y的值更改为N或将1的值更改为0,则应在组合框上显示此PS_PARAM值以供选择.

这是我的代码




When this value populating on grid some time I want to change the value of Y to N or 1 to 0, then this PS_PARAM value should be shown on a combobox to select.

this is my code


For Each drow As DataRow In dSetChangeStatus.SM_POS_SETUP.Rows

Dim strValueList As String = "Select PS_PARAM FROM SM_POS_SETUP Where PS_CODE = ''" & drow("PS_CODE") & "''"

Dim psValues As System.Data.SqlClient.SqlDataAdapter = New System.Data.SqlClient.SqlDataAdapter(strValueList, ConPOS)

Dim ds As DataSet = New System.Data.DataSet()

psValues.Fill(ds, "PS_PARAM")

Dim arrVal() As String = Split(drow("PS_PARAM"), ";")

Dim Column As Janus.Windows.GridEX.GridEXColumn = gridEXSetUp.RootTable.Columns("PS_VALUE")

Column.HasValueList = True

Dim valueList As Janus.Windows.GridEX.GridEXValueListItemCollection = Column.ValueList

valueList.PopulateValueList(ds.Tables("PS_PARAM").DefaultView, "PS_PARAM")

Column.EditType = Janus.Windows.GridEX.EditType.Combo


Next

推荐答案

如果PS_PARAM总是有3个符号,而第二个总是;",请尝试以这种方式询问您的数据库:
If PS_PARAM has always 3 signs and the second one is always ";", try to ask your database in this way:
SELECT SUBSTRING([PS_PARAM],1,1) AS PS_VALUES
  FROM [ERK].[dbo].[SM_POS_SETUP]
WHERE PS_CODE = 'A'
UNION ALL
SELECT SUBSTRING([PS_PARAM],3,1) AS PS_VALUES
  FROM [ERK].[dbo].[SM_POS_SETUP]
WHERE PS_CODE = 'A'


哪个SUBSTRING()函数返回字符串的一部分.
您应该看到结果(2行):
Y
N


我从未使用过控件:Janus.Windows.GridEX,所以我不能为您提供更多帮助.
我认为,您应该将此数据加载到数据表(而不是数据集)中,并用列填充它,但是首先您应该更改这部分代码:


which SUBSTRING() function returns part of string.
You should see results (2 rows):
Y
N


I have never used control: Janus.Windows.GridEX, so i can''t help you more.
I think, you should load this data to datatable (not dataset) and populate it with column, but first you should change this part of code:

Column.EditType = Janus.Windows.GridEX.EditType.Combo
valueList.PopulateValueList(ds.Tables("PS_PARAM").DefaultView, "PS_PARAM")


这篇关于数据GridView值列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆