我的项目有问题我需要将值放入listview定义列标题。
我的表名为tbl_writtenactivity,带有2个字段名称(Id,type)
我的表名为tbl_writtenwork,其中包含fielname rawscore
在我的项目中我有listview,我调用tbl_writtenactivity中的类型放在listview名称lsvscore的列标题中
这是我的类,将类型调用到lsvscore代码:
Public Sub setListColumnHeader(ByVal lsv As ListView, ByVal sec As String)
lsv.Columns.Clear()
Dim sql As String = "Select type from tbl_writtenactivity w inner join tbl_highscore h on w.id = h.writtenactivityId " & _
"inner join tbl_section se on h.sectionID = se.id where se.section ='" & sec & "'"
GLOBAL_VARS.d.execute(sql)
If GLOBAL_VARS.d.reader.HasRows Then
While GLOBAL_VARS.d.reader.Read()
With lsv
.Columns.Add(GLOBAL_VARS.d.reader("type").ToString(), 110, HorizontalAlignment.Left)
End With
End While
End If
GLOBAL_VARS.d.reader.Close()
End Sub
现在的问题是,只有我数据库中的最后一个循环放在我的listview中,这两个字段与内连接相连,并在我的sql脚本中使用columnheader作为我的where子句#
这是我调用值rawscore并放入listview项目的代码:
Public Sub contentlistview(ByVal lsv As ListView, ByVal activity As String)
lsv.Items.Clear()
Dim sql As String = "select w.id,w.rawscore from tbl_writtenwork w inner join tbl_highscore h on w.possibleScoreId_Written = h.id inner join tbl_writtenactivity wr on h.writtenactivityId = wr.id where wr.type = '" & activity & "'"
GLOBAL_VARS.d.execute(sql)
If GLOBAL_VARS.d.reader.HasRows Then
While GLOBAL_VARS.d.reader.Read
With lsv
.Items.Add(GLOBAL_VARS.d.reader("rawscore").ToString)
End With
End While
End If
GLOBAL_VARS.d.reader.Close()
End Sub
请帮助:抱歉,我不知道如何从桌面放置图片