----testdll.aspx<%@ Page explicit="true" %>
<script language="VB" runat="Server">
 
         [System.Runtime.InteropServices.DllImport("ADODB.dll"]
         '这个就是引用dll,不知这样写对不对,但出错,提示需要标识符。          Dim temp1 As Object
 Dim DBConn As ADODB.Connection   DBConn = New ADODB.Connection
 DBConn.Open("DRIVER={SQL Server};Server=bby;Database=OAT;UID=sa;PWD=")
 Session("DBConn") = DBConn  temp1 = Session("DBConn").Execute("SELECT UserName FROM User_Info WHERE UserID=001")
  
If Not temp1.EOF Then
 Session("UserName") = temp1(0)
          Response.Write("-----0-------)" +temp1(0))
End If
temp1.Close()
     
</script>

解决方案 »

  1.   

    http://www.itonline.gd.cn/ittech/list.asp?id=48
      

  2.   

    在项目中“引用”,右键-》添加引用,然后找到你的.dll文件添加。
    时间引用时实例化一下就可以啦。上面是c#的,VB的我没有用过,应该也一样吧
      

  3.   

    首先要
    Imports System.Runtime.InteropServices
    Public Class demo
            <DllImport("user32.dll")> Function CopyFile(ByVal address As String, ByVal username As String, ByVal password As String, ByVal localfn As String, ByVal remotefn As String) As Integer
            End Function
        End Class
    应用
    Dim demoClass As demo = New demo
              demoClass.CopyFile("1", "2", "3", "4", "5")
      

  4.   

    首先要
    Imports System.Runtime.InteropServices
    Public Class demo
            <DllImport("user32.dll")> Shared  Function CopyFile(ByVal address As String, ByVal username As String, ByVal password As String, ByVal localfn As String, ByVal remotefn As String) As Integer
            End Function
        End Class
    应用
    Dim demoClass As demo = New demo
              demoClass.CopyFile("1", "2", "3", "4", "5")
      

  5.   

    [System.Runtime.InteropServices.DllImport("ADODB.dll"]
             '这个就是引用dll,不知这样写对不对,但出错,提示需要标识符。
    这个是调用非托管代码的dll。
      

  6.   

    在vb中的调用与C#中不同,你用的是c#的调用  vb
    Imports System.Runtime.InteropServices<DllImport("user32.dll")>跟静态函数(类函数)
      

  7.   

    1, 添加引用DLL (必须是.NET的DLL或COM组件(DLL))
    2,NEW 一个实例,对实例进行操作。
      

  8.   

    to  slhuang(★Shawn★) ;
                           这是com组件(c++),能注册,把引用到项目里。
    然后NEW 一个实例,对实例进行操作。
                           调用里一个方法是出现:System.Runtime.InteropServices.COMException: java.lang.NullPointerException
                             为什么?????
             
      

  9.   

    to : paodiaole(跑掉了):
                            但这样调用感觉是不是好多限制了。比如我这个DLL中的类只是对初始化一些数据,根本不用返回值。
                   照你这样就引用就不行了,对不对啊。
      

  10.   

    同意  paodiaole(跑掉了) 的