"delete from table where datediff(""m"",dateColumn,date())>1"
你的 SQL 语句不在字符串引号中吗? VB 是不检查字符串内部语法的。仔细看看你的代码。
在 access 中:of123()回答 //"delete from table where datediff('m',dateColumn,date())>1" 正解!!! 注意'm'是半角单引号,dateColumn为日期字段!!
delete from [table] where datediff(month,dateColumn,getdate())>1
我代码是这样的,其中‘LiveIn’是表中字段,是日期型的,Date是当前日期, 如果超过一个月的话就删除。DBConnection.Execute ("delete from MainStatus where (DateDiff('m', LiveIn, Date)>0)")运行到这句时老提示::参数不足,期待值是1,为什么呢》? 错误出在哪呢??
如果实在找不到处理的函数,可以在程序中处理完之后,再通过SQL语句比较!
我开始用的就是你这句,但根本字体是红色的,提示‘m’有错。所以换了我那句。请各位帮忙啊
//"delete from table where datediff('m',dateColumn,date())>1"
正解!!!
注意'm'是半角单引号,dateColumn为日期字段!!
如果超过一个月的话就删除。DBConnection.Execute ("delete from MainStatus where (DateDiff('m', LiveIn, Date)>0)")运行到这句时老提示::参数不足,期待值是1,为什么呢》?
错误出在哪呢??