'Formula.GetBufDateData(i)可以在EXCEL中正常插入,可是到了数据库就没办法了,请问老师如何在数据库中插入stockdate时间啊,整了一晚上没整明白,站内的VBA教程下载不了,是否金子塔要放弃VBA了?
strSqlins="INSERT INTO if00 (stockdate, vclose) VALUES (Year(???????),'"&Formula.GetBufData("didu1",i)&"')"这句我该如何写哈
sub DataInsert()
'设置对象adoConn,进行连接
dim adoConn,strSqlcre1,strSqlcre2
Set adoConn=CreateObject("Adodb.Connection")
'连接数据库
dim report1,strSqlalt1,strSqlalt2,Grid,Formula,HistroyData,I,strSqlins
adoConn.Open"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=d:\test.mdb"
Set Grid = Technic.GetGridByName("Main")
set Formula = marketdata.STKINDI("if00","zj","xianxig()",0,5)
Set HistroyData = Formula.ParentGrid.GetHistoryData
for i =0 to HistroyData.Count-1
strSqlins="INSERT INTO if00 (stockdate, vclose) VALUES (Year(???????),'"&Formula.GetBufData("didu1",i)&"')"
adoConn.Execute(strSqlins)
Next