vb6封装的asp代码本地运行正常,在服务器上运行错误,何解?

aykkk 2019-08-10 09:45:39
本地电脑和服务器电脑都是win2008r2,数据库是sql2008r2,
用vb6封装的代码如下(编译成了一个dll)
Option Explicit

Private myscriptingcontext As ScriptingContext
Private myapplication As Application
Private myrequest As Request
Private myresponse As Response
Private myserver As Server
Private mysession As Session


Public Sub onstartpage(passedscriptingcontext As ScriptingContext)
Set myscriptingcontext = passedscriptingcontext
Set myapplication = myscriptingcontext.Application
Set myrequest = myscriptingcontext.Request
Set myresponse = myscriptingcontext.Response
Set myserver = myscriptingcontext.Server
Set mysession = myscriptingcontext.Session
End Sub


Public Sub onendpage()
Set myscriptingcontext = Nothing
Set myapplication = Nothing
Set myrequest = Nothing
Set myresponse = Nothing
Set myserver = Nothing
Set mysession = Nothing
End Sub


Public Sub welcome()
myresponse.Write ("welcome web2dll")
End Sub


Public Function Connectstring(dataip As String, dataname As String, datauser As String, datapwd As String) As String
Connectstring = "provider=sqloledb;data source=" & dataip & ";initial catalog=" & dataname & ";user id=" & datauser & ";password=" & datapwd & ";"
End Function


Public Function zjmxdqnd(c1 As String, c2 As String, c3 As String, c4 As String, tblpre As String) As String
Dim Cnn As ADODB.Connection
Set Cnn = New ADODB.Connection
Cnn.Open Connectstring(c1, c2, c3, c4)
Dim dqnd As String
dqnd = Cnn.Execute("select f_val from " & tblpre & "LSCONF where f_vkey='zw_kjnd'")(0)
zjmxdqnd = dqnd
zjmxdqnd_Exit:
Set Cnn = Nothing
Exit Function
End Function



建立的asp代码如下

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Inc/Conn.asp"-->
<%

cunid="dongfeng"
set rscun1=conn.execute("select * from ituser where uid='"&cunid&"'")
cunname=rscun1("xm")
dataip=rscun1("dataip")
dataname=rscun1("dataname")
datauser=rscun1("datauser")
datapwd=rscun1("datapwd")
tblpre=rscun1("tblpre")
rscun1.close
set rscun1=nothing
Response.Write("cunxm=" & cunname)
Response.Write("<br>")

set webdll= Server.CreateObject("hzz.sz")
webdll.welcome()

dqnd2=webdll.zjmxdqnd(cstr(dataip),cstr(dataname),cstr(datauser),cstr(datapwd),cstr(tblpre))
Response.Write("<br>dqnd2=" & dqnd2)

conn.close
set conn=nothing
set webdll=nothing

%>

上面这个asp代码在我本地电脑上可以正常取到数据,上传到服务器上运行的话,可以执行webdll.welcome(),但是下面的取数就错误了,问题出在什么地方呢?
...全文
89 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧