Dim MyConn
MyConn = Server.CreateObject("Name.Class")

解决方案 »

  1.   

    我这个是客户端用的组件。
    在VBScript中调用的。HTML文件用。
    不能用Server.CreateObject().
      

  2.   

    it should have nothing to do with ASP.NET, since you are creating objects on the client sideThe most likely cause to your problem is that the ActiveX security settings for the browser are very high
      

  3.   

    已试过,不是这个原因(ActiveX security settings for the browser)。
      

  4.   

    这个是测试代码:<%@ Page Language="vb" AutoEventWireup="true" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <title>WebForm1</title>

    <script language="vbscript">
    Option Explicit dim isAdd Sub MyClick()
    '------
    Dim oo 
    const iRowHead=3 '2
    Set oo= CreateObject("DLLPrint.HTMPrint") oo.Rows =200
    oo.Cols =20
    Dim sData(200 ,20)

    dim i
    dim j
    oo.FixedRows =iRowHead
    for i=0 to iRowHead -1
    for j=0 to oo.Cols -1
    sData(i,j)="列头" & cstr(i) & "," & cstr(j) & "" 
    next 
    next

    'For i=0 To oo.Rows-oo.FixedRows-1 
    For i=0 To oo.Rows-iRowHead-1   '在循环中尽量不用oo.FixedRows,用具体的数iRowHead,以免影响速度
    For j=0 To oo.Cols -1
    sData(i+iRowHead,j) = "打印(" & cstr(i) & "," & cstr(j) & ")" '不用 sData(i+oo.FixedRows,j)=...
    Next
    Next 
    sData(8,8)="打印之前10打印之前10打印之前10打印之前10打印之前10":sData(18,18)="打印之打印之前10打印之前10前11"

    oo.leftmargin =1000

    if isAdd=0 then
    oo.AddTitle "表头"
    isAdd=1
    end if
    if oo.GetPrintData(sData) then
    oo.Preview 
    end if
    erase sData
    Set oo=nothing
    exit sub
    '------
    End Sub
    -->
    </script>
    <meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
    <meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
    <meta content="VBScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" action="testPrintView.asp" method="post">
    <INPUT style="Z-INDEX: 104; LEFT: 178px; WIDTH: 165px; POSITION: absolute; TOP: 170px; HEIGHT: 28px" onclick="MyClick()" type="button" value="Button"></form>
    </body>
    </HTML>
      

  5.   

    1. make sure you have the component "DLLPrint" installed and properly registered on the client machine
    2. make sure all the settings related to ActiveX are ENABLED
      

  6.   

    下面是我用HTM文件调用的代码,一点问题都没有(双击运行或在Visual InterDev 6.0中运行没问题,但加入虚拟目录中后在IE6.0中用Http访问仍然有问题):<HTML>
    <HEAD>
    <META name=VI60_defaultClientScript content=VBScript>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    <TITLE>打印预览控件</TITLE>
    <SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
    <!--
    Option Explicitdim isAdd
    Sub Command1_onClick()
    '------
    Dim oo 
    const iRowHead=3 '2

    Set oo= CreateObject("DLLPrint.HTMPrint")
    oo.Rows =200
    oo.Cols =20
    Dim sData(200 ,20)

    'sData(0,0)="打印之前00":sData(0,1)="打印之前01"
    'sData(1,0)="打印之前10":sData(1,1)="打印之前11"
    dim i
    dim j
    oo.FixedRows =iRowHead
    for i=0 to iRowHead -1
    for j=0 to oo.Cols -1
    sData(i,j)="列头" & cstr(i) & "," & cstr(j) & "" 
    next 
    next

    'For i=0 To oo.Rows-oo.FixedRows-1 
    For i=0 To oo.Rows-iRowHead-1   '在循环中尽量不用oo.FixedRows,用具体的数iRowHead,以免影响速度
    For j=0 To oo.Cols -1
    sData(i+iRowHead,j) = "打印(" & cstr(i) & "," & cstr(j) & ")" '不用 sData(i+oo.FixedRows,j)=...
    Next
    Next 
    sData(8,8)="打印之前10打印之前10打印之前10打印之前10打印之前10":sData(18,18)="打印之打印之前10打印之前10前11"
    sData(4,4)=""

    oo.leftmargin =1000

    if isAdd=0 then
    oo.AddTitle "表头"
    isAdd=1
    end if
    if oo.GetPrintData(sData) then
    oo.Preview 
    end if
    erase sData
    Set oo=nothing
    exit sub
    '------
    End Sub-->
    </SCRIPT>
    </HEAD>
    <BODY>
    <INPUT id=command1 type=button value=打印测试>
    <div style="DISPLAY: none">&nbsp;
    </div>
    </BODY>
    </HTML>
      

  7.   

    对了,我的这个DllPrint 是个Active EXE控件(用c:\..\ DllPrint.exe /RegServer 注册),带模态和非模态窗口。
      

  8.   

    karma(无为) 说对了,确实是IE安全的问题,设为最低就行了。早上我的操作不对,没按Reset(设置)就按了确定。