如何把这段代码转换为VFP
<%
date1 = mid(Trim(Request("date1")),2,len(Trim(Request("date1")))-2)
date2 = mid(Trim(Request("date2")),2,len(Trim(Request("date2")))-2)
if date1=date2 then
date1=DateAdd("d", -29, date2)
end if
name = Request("name")
Const CONNECT = "FILEDSN=as_ORA"
%>
<%
set cn = Server.CreateObject( "ADODB.Connection" )
cn.Open CONNECT
SQL = "{call pkg_oil_cycweb.P_GET_KFDTSJ_CYSCSJ_DJ('1460130000','" & name & "','" & date1 & "','" & date2 & "',{resultset 3000, :s})}"
set cmd = server.CreateObject ("ADODB.Command")
with cmd
set .ActiveConnection= cn
.CommandText= SQL
.CommandType= 1'adCmdText
end with
dim total1(4,300),total2(300,4),total20(4,300),total3(300,4),total5(4,2)
set rs = server.CreateObject ( "ADODB.Recordset" )
set rs = cmd.execute
i=0
Do until rs.EOF
if rs("gzsj")<>"" then
total1(4,i)=rs("gzsj")
else
total1(4,i)=0
end if
i=i+1
rs.MoveNext
loop
%>
[解决办法]
昨天说漏了
& 改为 +
[解决办法]
VBA与VFP的语法有区别
MID->SUBSTR &->+
去掉SET、CONST之类的,
set rs = server.CreateObject ( "ADODB.Recordset" ) ->
rs = CreateObject ( "ADODB.Recordset" )
[解决办法]
vfp 操作 Oracle 请参考:
http://topic.csdn.net/u/20120323/09/9a27b84d-df7e-411a-84d5-e9e03b3e55ee.html
这个帖子是操作 MSSQL,你参考操作方式,需要更改的为:
连接串
SQL 语句
[解决办法]
lnRetVal的值是多少?用AERROR()捕获错误
[解决办法]
lnRetVal的值是-1
没有执行成功
lnRetVal=SQLExec(nhand,"{call pkg_oil_cycweb.P_GET_KFDTSJ_CYSCSJ_DJ('1460130000','" + name + "','" + date1 + "','" + date2 + "',{resultset 3000,:s})}",'temp')
=AERROR(aa)
disp memo
[解决办法]
连接成功了,说明连接代码没有问题了。
lnRetVal 值是-1,说明
{call pkg_oil_cycweb.P_GET_KFDTSJ_CYSCSJ_DJ('1460130000','" + name + "','" + date1 + "','" + date2 + "',{resultset 3000,:s})}
这个有问题,你先简单点调试,如先写 select * from 表名
[解决办法]
你在 Oracle 中直接运行这个语句,看看报错不?报错,到 Oracle 版帖一下你的 P_GET_KFDTSJ_CYSCSJ_DJ 过程内容,再问一下如何调用
{call pkg_oil_cycweb.P_GET_KFDTSJ_CYSCSJ_DJ('1460130000','test','2012-03-30','2012-03-30',{resultset 3000,:s})}