求助:关于将listview1中的所有内容写入到数据库中,并能安原来的顺序读出来!就是listview1中
每行都是
列1 列2
行1 [2005-10-24 10:12:13] [2005-10-25 10:15:12]
行2 [2005-10-26 10:12:13] [2005-10-26 10:15:12]将它们存储到数据库中,并按现在的顺序读出来!情大家帮帮忙,给个代码!
每行都是
列1 列2
行1 [2005-10-24 10:12:13] [2005-10-25 10:15:12]
行2 [2005-10-26 10:12:13] [2005-10-26 10:15:12]将它们存储到数据库中,并按现在的顺序读出来!情大家帮帮忙,给个代码!
把每条记录加序号就是,读出按序号排序就是啊~
dim Mitem as Listitem
dim i as integer
dim str as string
dim cnn as new adodb.connection
cnn.open .........
for i=0 to Listview1.listitems.count-1
set Mitem=Listview1.Listitems(i)
str=cstr(i)
str=str+Mitem.caption
str=str+","+Mitem.subitems.item(1).text
cnn.execute "insert into table select "+str
next
cnn.close
'读出
dim Mitem as Listitem
dim Rst as new adodb.recordset
dim cnn as new adodb.connection
dim i as integer
cnn.open .........rst.open "select * from table order by id"
if rst.eof then
do while not rst.eof
set mitem=Listview1.listitems.add (i,"K"+rst(1)&"",rst(1)&"")
mitem.subitems(1)=rst(2)&""
rst.movenext
loop
end if
rst.close
str=str+","+Mitem.subitems.item(1).text
'改
str=str+","+Mitem.subitems(1)
rst.open "select * from table order by id"
'改
rst.open "select * from table order by id",cnn,1,2