【发布时间】:2015-11-18 23:25:36
【问题描述】:
我发布了一个问题,要求帮助在 vb6 中使用来自 SQL-SERVER 的数据填充 ListView。所以我能够做到这一点。我正在加载运动的名称,并为每个值分配了 ID。代码如下:
lvwExpenditures.ListItems.Clear
With lvwExpenditures
.FullRowSelect = True
.View = lvwReport
.LabelEdit = lvwManual
.ColumnHeaders.Add , "FldName", "Expense", 2200
.ColumnHeaders.Add , "ID", "ID", 0
End With
g_strSQL = "Select FldName, ID, Label, SortOrder from dbo.tblText_References where fldname ='expenditureitems'"
rs.Open g_strSQL, g_cnDatabase, adOpenStatic
Debug.Print g_strSQL
With rs
Do While Not .EOF
Set lvwItem = lvwExpenditures.ListItems.Add(, , .Fields("Label").Value)
lvwItem.SubItems(1) = .Fields("ID").Value 'Populate Date column
.MoveNext
Loop
End With
Set rs = Nothing
所以现在,如果用户愿意,我需要让用户从 ListView 中选择多个项目。我用复选框做到了,但我试图在没有它们的情况下做到这一点。此外,如果用户选择多个项目,我的 Insert 语句会是什么样子。我只需要保存与 ID 关联的 ID,并将它们连接起来。谢谢!
【问题讨论】:
标签: sql-server listview vb6