以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  如何找到最后一条或上一条或下一条或第一条记录  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=2494)

--  作者:baoxyang
--  发布时间:2009/4/17 18:17:00
--  如何找到最后一条或上一条或下一条或第一条记录
dim tt as string
Dim cmd As New SQLCommand
dim dt as datatable
cmd.C
cmd.commandtext = "select * From [入库] where 单号 like \'IP%\' "
dt = cmd.ExecuteReader()
dim dr as datarow
如何编写找到最后一条或上一条或下一条或第一条记录语句。
tt = dr(“列A”)(最后一条)
tt = dr(“列A”)(上一条)
tt = dr(“列A”)(下一条)
tt = dr(“列A”)(第一条)
谢谢帮忙!


--  作者:易服
--  发布时间:2009/4/17 23:09:00
--  

第一行:
Tables("表名").Position = 0
上一行:
With Tables("表名")
    .Position = .Position - 1
End With
下一行:
With Tables("表名")
    .Position = .Position + 1
End With

最末行:
With Tables("表名")
    .Position = .Rows.Count - 1
End With


--  作者:baoxyang
--  发布时间:2009/4/18 8:28:00
--  

谢了,我已解决了。


--  作者:yangming
--  发布时间:2009/4/19 15:28:00
--  

通用的,表示当前表:

第一行:
With CurrentTable
    .Position = 0
End With


上一行:
With CurrentTable 
    .Position = .Position - 1
End With

下一行:
With CurrentTable 
    .Position = .Position + 1
End With


最末行:
With CurrentTable 
    .Position = .Rows.Count - 1
End With