以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  timestamp类型的字段如何获取?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=63686)

--  作者:飞飞
--  发布时间:2015/1/26 15:26:00
--  timestamp类型的字段如何获取?
 Dim dr As DataRow = DataTables("mytable").Find("1=1")
Output.Show(dr("sys_timestamp"))

结果是0
why?
应该怎么获取timestamp的值?

--  作者:有点甜
--  发布时间:2015/1/26 15:30:00
--  
 什么意思,你find查找到的是第一行啊,然后这一行的这一列的值是0啊
--  作者:飞飞
--  发布时间:2015/1/26 15:32:00
--  
 sys_timestamp 字段类型是 timestamp
他在数据库的值是“0x00000000000D222A”
二在foxtable打印出来是0

--  作者:Bin
--  发布时间:2015/1/26 15:33:00
--  
你找到的一行是空值.
--  作者:Bin
--  发布时间:2015/1/26 15:34:00
--  
你取一个有值的行看看
--  作者:Bin
--  发布时间:2015/1/26 15:37:00
--  
类型转换可以看这里

本地时间转时间戳

Dim dtStart As DateTime = TimeZone.CurrentTimeZone.ToLocalTime(New DateTime(1970, 1, 1))
Dim dtNow As DateTime = DateTime.Parse(DateTime.Now.ToString())
Dim toNow As TimeSpan = dtNow.Subtract(dtStart)
Dim timeStamp As String = toNow.Ticks.ToString()
timeStamp = timeStamp.Substring(0, timeStamp.Length - 7)
时间戳转本地时间

Dim GetTimeStamp As L
Dim dtStart As DateTime = TimeZone.CurrentTimeZone.ToLocalTime(New DateTime(1970, 1, 1))
Dim lTime As Long = Long.Parse(GetTimeStamp + "0000000")
Dim toNow As TimeSpan = New TimeSpan(lTime)
Dim dtResult As DateTime = dtStart.Add(toNow)

--  作者:有点甜
--  发布时间:2015/1/26 15:37:00
--  
 foxtable 不支持此类型,要么你用字符类型,要么改成时间日期类型
--  作者:飞飞
--  发布时间:2015/1/26 15:37:00
--  
不是空行啊
Dim dr As DataRow = DataTables("io_list").Find("1=1")
Output.Show(dr("sys_timestamp") & "-" & dr("创建人"))
显示
0-debug

--  作者:Bin
--  发布时间:2015/1/26 15:38:00
--  
看7楼
--  作者:飞飞
--  发布时间:2015/1/26 15:39:00
--  
3q