在VB中如何查询数据库最早时间并且赋值给日期变量?我的数据库时间类型是文本的,初学,请教一下,谢谢!
DimcnnmdbAsADODB.ConnectionDimaAsDateDimbAsDateSetcnnmdb=NewADODB.Connectioncnnmdb.Op...
Dim cnnmdb As ADODB.Connection
Dim a As Date
Dim b As Date
Set cnnmdb = New ADODB.Connection
cnnmdb.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\110.mdb;Persist Security Info=False"
a = cnnmdb.Execute("select top 1 from sheet1 order by CDate(T) desc")
b = cnnmdb.Execute("select top 1 from sheet1 order by CDate(T) asc") 展开
Dim a As Date
Dim b As Date
Set cnnmdb = New ADODB.Connection
cnnmdb.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\110.mdb;Persist Security Info=False"
a = cnnmdb.Execute("select top 1 from sheet1 order by CDate(T) desc")
b = cnnmdb.Execute("select top 1 from sheet1 order by CDate(T) asc") 展开
1个回答
展开全部
Dim cnnmdb As ADODB.Connection
dim rs1 as recordset
Dim a As Date
Dim b As Date
Set cnnmdb = New ADODB.Connection
cnnmdb.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\110.mdb;Persist Security Info=False"
set rs1=cnnmdb.Execute("select top 1 * from sheet1 order by CDate(T) desc")
a =CDate( rs1("日期字段名"))
set rs1 = cnnmdb.Execute("select top 1* from sheet1 order by CDate(T) asc")
b =CDate( rs1("日期字段名"))
dim rs1 as recordset
Dim a As Date
Dim b As Date
Set cnnmdb = New ADODB.Connection
cnnmdb.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\110.mdb;Persist Security Info=False"
set rs1=cnnmdb.Execute("select top 1 * from sheet1 order by CDate(T) desc")
a =CDate( rs1("日期字段名"))
set rs1 = cnnmdb.Execute("select top 1* from sheet1 order by CDate(T) asc")
b =CDate( rs1("日期字段名"))
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询