50分在线等, 如何用asp更改dbf的记录, 特别是日期型和布尔类型
我用asp写了一个函数, 如下
function exeupdate(sql)
sql = sql & " "
const adOpenForwardOnly = 0
const adOpenKeyset = 1
const adOpenDynamic = 2
const adOpenStatic = 3
const adLockReadOnly = 1
const adLockPessimistic = 2
const adLockOptimistic = 3
const adLockBatchOptimistic = 4
Const adCmdUnknown = &H0008
Const adCmdText = &H0001
Const adCmdTable = &H0002
Const adCmdStoredProc = &H0004
Const adCmdFile = &H0100
Const adCmdTableDirect = &H0200
Dim oCONv, oRSu
Set oCONv = Server.CreateObject( "ADODB.Connection ")
oCONv.Open "Driver={Microsoft dBASE Driver (*.dbf)}; " &_
"DriverID=277; " &_
"Dbq= " & Server.MapPath ( "../rmwin/ ")
set oRSu = Server.CreateObject( "ADODB.RecordSet ")
oRSu.open sql,oCONv, , ,adCmdText
end function
但是调用
exeupdate "update inventor.dbf set LAST_DATE=ctod( '2007-06-13 '), isupdate=.T.Invent_no = Invent_no where Invent_no=1 "
的时候, 系统说:
(1) Undefined function 'ctod ' in expression.
(2) .T.不合法
这句sql语句在vfp的命令窗口中运行正常, 请问大家是什么原因?
[解决办法]
安装oledb for vfp试试,可支持vfp的大部分命令
建一ado连接,选oledb for vfp,如果是数据库,连接到数据库,如果是自由表,连接到自由表所在目录,然后建一ado command或用ado连接的execute方法,执行命令
http://www.microsoft.com/downloads/details.aspx?FamilyId=E1A87D8F-2D58-491F-A0FA-95A3289C5FD4&displaylang=en
File Name: vfpoledb.exe
Version: 1.1
Date Published: 1/5/2006
Language: English
Download Size: 2.5 MB
[解决办法]
1 exeupdate "update inventor.dbf set LAST_DATE={^2007-06-13}, isupdate=1,Invent_no = Invent_no where Invent_no=1 "
2
ADO连接DBF
Provider=VFPOLEDB.1;Data Source=D:\ZZ;Password= " ";Collating Sequence=MACHINE