如题
看看怎么绑定数据到dropdownlist
[此贴子已经被作者于2006-9-20 14:06:13编辑过]
我是这样写的
myQuery = "select Id,UserName,Class from Operator order by Id"
If myclsDB.DB(myQuery) = False Then
Exit Sub
Else
For i = 0 To myclsDB.dataset.Tables(0).Rows.Count - 1
With myclsDB.dataset.Tables(0)
stritem = .Rows(i).Item(0)
item = New ListViewItem(stritem)
subitem1 = New ListViewItem.ListViewSubItem(item, .Rows(i).Item(0))
subitem2 = New ListViewItem.ListViewSubItem(item, .Rows(i).Item(1))
subitem3 = New ListViewItem.ListViewSubItem(item, .Rows(i).Item(2))
item.SubItems.Add(subitem1)
item.SubItems.Add(subitem2)
item.SubItems.Add(subitem3)
lsvResult.Items.Add(item)
End With
Next
End If
但是显示的数据有点问题啊!!
比如 要显示下面的数据时
ID UserName Class
1 tt 3
它会这样显示啊!
ID UserName Class
1 1 tt
请问为什么啊?
我是这样写的
myQuery = "select Id,UserName,Class from Operator order by Id"
If myclsDB.DB(myQuery) = False Then
Exit Sub
Else
For i = 0 To myclsDB.dataset.Tables(0).Rows.Count - 1
With myclsDB.dataset.Tables(0)
stritem = .Rows(i).Item(0)
item = New ListViewItem(stritem)
subitem1 = New ListViewItem.ListViewSubItem(item, .Rows(i).Item(0))
subitem2 = New ListViewItem.ListViewSubItem(item, .Rows(i).Item(1))
subitem3 = New ListViewItem.ListViewSubItem(item, .Rows(i).Item(2))
item.SubItems.Add(subitem1)
item.SubItems.Add(subitem2)
item.SubItems.Add(subitem3)
lsvResult.Items.Add(item)
End With
Next
End If
但是显示的数据有点问题啊!!
比如 要显示下面的数据时
ID UserName Class
1 tt 3
它会这样显示啊!
ID UserName Class
1 1 tt
请问为什么啊?