xojo中有没有不重复相同行的方法?

问题描述

我在xojo中创建了这个网格,问题是即使我出门又回来,它也会像以前一样复制相同的行,

那是只有3条记录的原始表:first screenshot

然后我制定了一种添加行的方法

Dim i As Integer
Dim v As String
Dim count As Integer
Dim thesql As String
Dim f As FolderItem
Dim found As Boolean
Dim fin As Integer
Dim vdescrizione1 As String
dim vdatafin as String
dim VnumRec as Integer


//DB MysqL
Dim db As MysqLCommunityServer
Dim dbfile As folderItem
Dim rec As databaserecord
Dim rs As recordSet

//initialization DB MysqL
rec=New databaserecord
db=New MysqLCommunityServer

//CONNECTION WEB
db.host ="----"
db.userName = "----"
db.password ="-----"
db.port=----
db.databaseName ="----"

If db.connect Then
Else
MsgBox "MysqL Portal Data File not available" 
End If


thesql="Select id,nome,cognome,sesso,residenza,annoNascita FROM CnaPr.Utente"

rs=db.sqlSelect(thesql)

dim intCycle as Integer=1
dim intMax as Integer = 1000

dim intRow as Integer
dim vfp as Integer
dim r as new Random
dim cValue as Color = rgb( r.InRange( 0,255 ),r.InRange( 0,255 ) )
dim blnED as Boolean

while not rs.eOF
dim dict as new Dictionary( "K_ID" : rs.field("id").value,_
"K_Nominativo" :  rs.field("nome").value,_
"K_Cognome" :  rs.field("cognome").value,_
"KSesso" :  rs.field("sesso").value,_
"KFinePratica" :  blnED,_
"K_Residenza" :  rs.field("residenza").value,_
"K_Data" :  rs.field("annoNascita").value)

 dim newRow as new GraffitiWebGridRow( dict )
 newRow.Tag = intRow
 AllRows.Append( newRow )
 rs.MoveNext
 Wend

 gwpMain.TotalPages = Ceil(intMax / 20)
 LoadPage( 0 )

第二种方法

dim pageMin as Integer = pageIndex * rowsPerPage
//rowsPerPage
dim pageMax as Integer = pageMin + rowsPerPage
dim maxPages as Integer = (AllRows.Ubound +1 ) / rowsPerPage

if pageIndex < 0 or pageIndex > maxPages then Return

GridList.LockUpdate = True
GridList.DeleteallRows()

for intCycle as Integer = pageMin to Min( pageMax - 1,AllRows.Ubound )
GridList.AddRow( AllRows(intCycle) )
next
GridList.LockUpdate = False
currentPage = pageIndex

当我返回上一页然后返回到表格时,它并没有留下我所拥有的记录,相反,它会复制它们, second screenshot

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)