0

我们正在将一些 Web 应用程序从 Microsoft Server 2003 迁移到 2008,而这一功能似乎无法正常工作,因为它通常填充的字段是空的。这是代码:

function get_name(emp_nbr)  
sql3 = "select LTRIM(RTRIM(INITCAP(COMMON_NAME))) COMMON_NAME, LTRIM(RTRIM(INITCAP(LAST_NAME))) last_name from (select EMPLOYEE_NBR,COMMON_NAME, LAST_NAME  from hrit_admin.employee union all  select   CONTRACT_RESOURCE_ID, COMMON_NAME, LAST_NAME  from   hrit_admin.contract_resource) a where EMPLOYEE_NBR = a.EMPLOYEE_NBR and EMPLOYEE_NBRr = " & emp_nbr   
rs3.open sql3,conn
get_name = rs3("COMMON_NAME") & " " & rs3("LAST_NAME") 
rs3.close
end function 

任何帮助将不胜感激。

4

3 回答 3

0

您是否将新服务器上的查询作为直接 SQL 运行并得到正确的结果?

您是否使用该连接字符串执行了简单查询?

你能在服务器上做一个hello world asp经典例子吗?

于 2013-06-19T18:30:22.000 回答
0

您是否检查过是否启用了 Classic Asp。2008 年不是默认设置。

于 2013-06-19T18:33:19.680 回答
0

尝试:

function get_name(emp_nbr) 
Dim CommonName,LastName,FullName 
    sql3 = "select LTRIM(RTRIM(INITCAP(COMMON_NAME))) COMMON_NAME, LTRIM(RTRIM(INITCAP(LAST_NAME))) last_name from (select EMPLOYEE_NBR,COMMON_NAME, LAST_NAME  from hrit_admin.employee union all  select   CONTRACT_RESOURCE_ID, COMMON_NAME, LAST_NAME  from   hrit_admin.contract_resource) a where EMPLOYEE_NBR = a.EMPLOYEE_NBR and EMPLOYEE_NBRr = " & emp_nbr   
    rs3.open sql3,conn
    CommonName = rs3("COMMON_NAME")
    LastName = rs3("last_name")
    rs3.close
    FullName = CommonName & " " & LastName
    get_name = FullName
end function 
于 2013-06-20T08:45:11.977 回答