以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]Find 的问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=11910)

--  作者:sunjgjd
--  发布时间:2011/8/16 15:39:00
--  [求助]Find 的问题
刚刚接触了Foxtable没几天,正在消化中。现碰到个问题,请求帮助:

Dim dr As DataRow
dr =
DataTables("订单").Find("[产品] = \'PD01\'", "日期 Desc")
If
dr IsNot Nothing Then
Dim
wz As Integer = Tables("订单").FindRow(dr)
If
wz >= 0 Then
Tables
("订单").Position = wz

End If
End If

以上这段代码,是帮助中的事例。现在的问题,PD01 在上面的代码中是个字符串常量,由于程序的需要,我需要将 PD01 改成变量(即每次查找的产品是不同的),那我应该怎么写这句涉及 Find 的代码?
先谢了!

--  作者:狐狸爸爸
--  发布时间:2011/8/16 15:42:00
--  

Dim dr As DataRow
Dim pd As String = "PD01"
dr = DataTables("订单").Find("[产品] = \'" & pd & "\'", "日期 Desc")
If dr IsNot Nothing Then
    Dim wz As Integer = Tables("订单").FindRow(dr)
    If wz >= 0 Then
        Tables("订单").Position = wz
    End If
End If

 

参考:

http://www.foxtable.com/help/topics/1284.htm

http://www.foxtable.com/help/topics/1058.htm

 

不过最好还是按顺序看帮助,看三遍。


--  作者:sunjgjd
--  发布时间:2011/8/16 15:44:00
--  
感谢狐爸!
--  作者:H2H41982
--  发布时间:2011/10/25 14:04:00
--  

dim v as string

dr = DataTables("订单").Find("[产品] = \'" & v & "\'")