zoukankan      html  css  js  c++  java
  • 在vbscritp 中调用 C#生成的dll 组件

    环境:vs2005,window XP 

    第一步:
      添加一个类库组件,添加cs文件,代码如下:
       using System;
       using System.Collections.Generic;
       using System.Text;

       namespace AspDll
       {
           public class firstDll
           {
               public firstDll()
               { }
               public int Contulation(int a,int b)
               {
                      return a + b; 
               }
               public string returnHello(string name)
               {
                   return "Hello" + name;
               }
           }
       }

    第二步:
       打开类文件所在项目属性页,选择"生成"标签,把"为COM Interop 注册"勾上.
    第三步:
        把AssemblyInfo.cs文件中的[assembly: ComVisible(false)] 改为[assembly: ComVisible(true)]

    第四步:编译生成.dll
    第五步:在Asp调用:
       set clsa=server.CreateObject("AspDll.firstDll")
            three=clsa.returnHello("china")
        response.Write("<script>alert('"&three&"')</script>")

    <完>

  • 相关阅读:
    设计模式-装饰器模式
    自定义 RestTemplate 异常处理 (转)
    Jackson 高级应用
    Jackson 的 基本用法
    Jackson转换为Collection、Array
    Jackson中处理map中的null key 或者null value 及实体字段中的null value
    sed
    MySQL server has gone away 异常
    nl命令
    线程池
  • 原文地址:https://www.cnblogs.com/subingster/p/839144.html
Copyright © 2011-2022 走看看