日期:2014-05-18  浏览次数:20419 次

关于华表的自定义函数的问题
华表给出的例子中都是有参数的自定义函数

我按照他给的例子也作了一个 "HLB(....) "的函数,返回了数据库中的值,
但是到了无参数函数时出现问题:xmlhttp.setRequestHeader   类型不匹配   各位帮忙
Function   HTTPPOST(functionName,params)
URL   =   "CustomizedFun.asmx/ "   &   functionName
  Set   xmlhttp   =   CreateObject( "Microsoft.XMLHTTP ")
  xmlhttp.Open   "POST ",URL,False
  xmlhttp.setRequestHeader   "Content-Type ",   "application/x-www-form-urlencoded "
      params_len=LEN(Params)
      xmlhttp.setRequestHeader   "Content-Length ",params_len
      xmlhttp.Send(params)
      Set   x   =   xmlhttp.responseXML
      alert(x.childNodes(1).text)
     
'那么如何知道是否调用成功呢,状态为200说明调用成功,500则说明出错
  alert(xmlhttp.Status)
'alert(xmlhttp.StatusText)
      Set   xmlhttp   =   Nothing
      HTTPPOST=x.childNodes(1).text
'   end   if

End   Function
Function   HLB(row,column,sheet,reportid,year)

  'row1=int(row)
  'column1=int(column)
  'row=5
  'column=6
  'ret= "prefix "&   DCellWeb1.GetCellDouble(row,column,0)
  'msgbox   ret
  'url= "CustomizedFun.asmx/HLB?arg1= "&arg1
 
str   =   "row= "   &   row   &   "& "   &   "column= "   &   column   & "& "   &   "sheet= "   &   sheet   &   "& "   &   "reportid= "   &   reportid   &   "& "   &   "year= "   &   year
                    HLB=   HTTPPOST( "HLB ",str)

end   function



Function   bb_year(null)  

    bb_year=   HTTPPOST( "bb_year ",null)
end   function


      Sub   DCellWeb1_CalcFunc(ByVal   name,   ByVal   rettype,   ByVal   paranum)
                         
                          Select   Case   name

                            Case   "HLB "
                                paranum=5
                                para1   =   DCellWeb1.GetFuncDoublePara(0,   isDefault)
                                para2   =   DCellWeb1.GetFuncDoublePara(1,   isDefault)
                                para3   =   DCellWeb1.GetFuncDoublePara(2,   isDefault)