日期:2014-05-16  浏览次数:20422 次

asp.net中利用JS调用Delphi开发的ocx里面的方法提示对象不支持此属性或方法
Delphi开发的ActiveX代码如下:
function TActiveFormX.getnew(const strid: WideString; i: Integer): WideString;
var sqlstr:string;
var strnum:string;
var strZhiqu:string;
var strQudao:string;
var strCity:string;

begin
  qry1.Close;
              qry1.SQL.Clear;
              sqlstr:='select * from yj_tableinfo  where yj_id=:yj_id';
              qry1.SQL.Text:=sqlstr;
              qry1.Parameters.ParamByName('yj_id').Value:=strid;
              qry1.Open;
        case i of
          1: begin 

          strnum:=qry1.FieldByName('yj_table_21').AsString;
          strZhiqu:=qry1.FieldByName('yj_table_1').AsString;
          strQudao:=qry1.FieldByName('yj_table_22').AsString;

          s1:=split(strnum,'*');
          s2:=split(strZhiqu,'*');
          s5:=split(strQudao,'*');
          for i := 0 to s1.Count-1 do
          begin
          checkstr[i]:=Copy(s1[i],1,Length(s1[i])-1);
          end;
           for i := 0 to s2.Count-1 do
          begin
          zhiquStr[i]:=Copy(s2[i],1,Length(s2[i])-1);
          end;
              for i := 0 to s5.Count-1 do
          begin
          qudaoStr[i]:=Copy(s5[i],1,Length(s5[i])-1);
          end;
                    //打印
                    frprtK.PrepareReport;
                    frprtK.PrintPreparedReport('',1,true,frall);

          end;
         end;
         end;
此方法在Delphi发布的网页中测试是没错的

在asp.net网站中调用的时候是这样写的
        <object id='obj' classid="clsid:5511CF5A-C7BD-4777-B5EC-3D0E771E207B" codebase="ActiveFormProj1.ocx#version=1,0,0,0"
            width="350" height="