假如我在ConnDB.asp
中调用了一个dll Com件(这个dll是用c++写的,主要是用来取得数据库联接,然后把查询的sql语句执行完,保存到一个数据集里)
在这里,调用成功!~!!现在,我把vb写的ConnDB.asp 升级到 vb.net写的ConnDB.aspx(不会出现其它错误)
请问,能不能同样调用这个dll哪我先注册,之后同样 就按照vb.net调用组件方法 New 这个dll
但发现,没用??高手出招???为何啊,我应该如何调用/????

解决方案 »

  1.   

    自己参考
    ms-help://MS.NETFrameworkSDKv1.1.CHS/cpguidenf/html/cpconexposingcomcomponentstonetframework.htm
      

  2.   

    vs.net2003开发环境下,在工程的引用里可以添加com的dll的。
      

  3.   

    aspx可以调用c/s里的.dll
    但是客户端调用得装.net framework/
      

  4.   

    同样可以调用。
    添加引用。引用COM组件,如果你的COM DLL已经注册会可以找到的。
      

  5.   

    非常以上的回复
    to slhuang(★Shawn★) :
                           注册后可以找到,但不知为什么,调用DLL里面的方法,
    返回的不是结果集。而只是一个类型。
                          
         实例化这个dll中一个类的时候,没问题,也就是说找到了这个类。
    但就是里面的内容调用失败了。
    为何?
      

  6.   

    1. re-write the COM object in C# or VB.NET2. >>>现在,我把vb写的ConnDB.asp 升级到 vb.net写的ConnDB.aspx(不会出现其它错误)
    请问,能不能同样调用这个dll哪yes, you could add a reference to the COM object, and then create an object and call its method3. >>>但就是里面的内容调用失败了what error message? what os are you using? make sure ASPNET account (or Network Service Account for windows 2003 server) has permissions to execute your COM component
      

  7.   

    suggestion, try to write a Console Application in VB.NET and use your COM component, make sure it works before using it in ASP.NET
      

  8.   

    先引用对象: <OBJECT id="ACStart" codeBase="../../system/acstart.ocx#version=1,0,0,2" height="0" width="0"
    classid="clsid:79B13EA1-83FB-49FD-A0D0-3F10C447DF75" VIEWASTEXT>
    <PARAM NAME="_Version" VALUE="65536">
    <PARAM NAME="_ExtentX" VALUE="26">
    <PARAM NAME="_ExtentY" VALUE="26">
    <PARAM NAME="_StockProps" VALUE="0">
    </OBJECT>
    <script language="vbscript">
    Sub OnPlayACC(acc_url)
    if acc_url<>"" then
    document.ACStart.Start "SOFTWARE\iActive\ACPlayer4", "ACPlayer.exe", acc_url
    end if
    End Sub
    Sub test()
    MsgBox "请输入一个数字。"
    End Sub 
    </script>
      

  9.   

    最调用方法:
    asp:repeater id="Repeater1" runat="server">
    <HeaderTemplate>
    <table border="1">
    <tr>
    <td><b>stringid</b></td>
    <td><b>stringmap</b></td>
    <td><b>name1</b></td>
    <td><b>name1</b></td>
    <td><b>name1</b></td>
    <td><b>name1</b></td>
    </tr>
    </HeaderTemplate>
    <ItemTemplate>
    <tr>
    <td>
    <asp:Label ID=name1 Runat=server Text='<%#DataBinder.Eval(Container.DataItem,"stringid")%>'>
    </asp:Label>
    </td>
    <td>
    <asp:Label ID="Label1" Runat=server Text='<%#DataBinder.Eval(Container.DataItem,"stringmap")%>'>
    </asp:Label>
    </td>
    <td>
    <asp:Button ID="bt1" Runat="server" Text="事件"></asp:Button>
    </td>
    <td><A id="xufg" onclick="vbscript:OnPlayACC('D:\VSS\远程教育\其他公司资料\demo2.acc')" href="#">xufg</A>
    </td>
    <td><A id="A1" onclick="vbscript:OnPlayACC('<%#DataBinder.Eval(Container.DataItem,"stringmap")%>')" href="#">xufgA1</A><!--"<%#DataBinder.Eval(Container.DataItem,"stringmap")%>"-->
    </td>
    <td><A id="A2" onclick="vbscript:test()" href="#"><%#DataBinder.Eval(Container.DataItem,"stringmap")%></A>
    </td>
    </tr>
    </ItemTemplate>
    </asp:repeater>
      

  10.   

    兄弟。你也是关于asp移植到asp.net中的问题。我这样做在前台,我已经通过。但是在后台调用。我还在想办法。不知道为什么不能在后台执行 vbscript 的函数。如果有什么好东西。请加我 :381350421
      

  11.   

    [DllImport("sde83.dll",  
                 SetLastError = true,
                 ThrowOnUnmappableChar = true)]
      

  12.   

    to nmlvjun(网事如风)
                       说需要标识符,是什么意思? 我这样写怎么出错了。是如何
    引用dll的啊。以下是aspx的内容。错在哪儿了?我在asp中调用测试通过了。
    但在asp.net不行啊。----testdll.aspx<%@ Page explicit="true" %>
    <script language="VB" runat="Server">
     
             [System.Runtime.InteropServices.DllImport("ADODB.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 tempHRMRs.EOF Then
     Session("UserName") = temp1(0)
              Response.Write("-----0-------)" +tempHRMRs(0))
    End If
    temp1.Close()
         
    </script>
      

  13.   

    靠,弄错了。
    ----testdll.aspx<%@ Page explicit="true" %>
    <script language="VB" runat="Server">
     
             [System.Runtime.InteropServices.DllImport("ADODB.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>
      

  14.   

    don't use ADO, use classes in System.Data.SqlClient or System.Data.OleDb or System.Data.Odbcif you insist, seehttp://www.c-sharpcorner.com/Code/2002/Dec/ADODBService.asphttp://www.vbdotnetheaven.com/Code/Jul2003/2129.asp
      

  15.   

    coffeemilk(尾巴十一) 
    你明天 加我 381350421 我发你。
      

  16.   

    saucer(思归) :
                  思归,你可能误解我的意思了,我知道完全可以利用现有的ado.net实现
    但是呢。我就是想知道在vb.net写的aspx 如何调用c++写的dll.
      [System.Runtime.InteropServices.DllImport("ADODB.dll"])这样写,对不对?
    我应该如何写? 非常感谢
      

  17.   

    to  xufengguo(风) :
                      已经加你了,查收
      

  18.   

    The links I provided should tell you how to add references to exisiting COM components and how to use themor see
    Chapter 3: The Essentials for Using COM in Managed Code
    http://www.wimdows.net/books/sams/netcominter/067232170x/067232170x_ch03.html
      

  19.   

    思归大哥: 
             1, 添加引用DLL (必须是.NET的DLL或COM组件(DLL))
             2,NEW 一个实例,对实例进行操作。     调用里一个方法是出现:System.Runtime.InteropServices.COMException: java.lang.NullPointerException
                             为什么?????请思归一定紧跟这个问题。非常感谢。整个项目就卡壳了。
      

  20.   

    if you can, show some code, and tell us more about your component and how are you calling it?also, try the example in the links with ADODB, make sure the COM Interop works on your machine
      

  21.   

    要不,这样吧。我发我的一个dll给你。
                  看看你哪儿行不行。好不好。
    我真的不行了,项目好紧的。我如何发给你DLL。
     就引用,NEW一下。然后调用一个方法。就行了。
    看看有没有我这个问题。
    这个DLL用在asp里调用是没错的。我如何联系你。留言到我的留言簿里~!!!
    非常感谢
                      
      

  22.   

    这就奇怪了怎么抛出java里的异常啊
    这dll谁会用java来写啊。java.lang.NullPointerException????