假如我在ConnDB.asp
中调用了一个dll Com件(这个dll是用c++写的,主要是用来取得数据库联接,然后把查询的sql语句执行完,保存到一个数据集里)
在这里,调用成功!~!!现在,我把vb写的ConnDB.asp 升级到 vb.net写的ConnDB.aspx(不会出现其它错误)
请问,能不能同样调用这个dll哪我先注册,之后同样 就按照vb.net调用组件方法 New 这个dll
但发现,没用??高手出招???为何啊,我应该如何调用/????
中调用了一个dll Com件(这个dll是用c++写的,主要是用来取得数据库联接,然后把查询的sql语句执行完,保存到一个数据集里)
在这里,调用成功!~!!现在,我把vb写的ConnDB.asp 升级到 vb.net写的ConnDB.aspx(不会出现其它错误)
请问,能不能同样调用这个dll哪我先注册,之后同样 就按照vb.net调用组件方法 New 这个dll
但发现,没用??高手出招???为何啊,我应该如何调用/????
ms-help://MS.NETFrameworkSDKv1.1.CHS/cpguidenf/html/cpconexposingcomcomponentstonetframework.htm
但是客户端调用得装.net framework/
添加引用。引用COM组件,如果你的COM DLL已经注册会可以找到的。
to slhuang(★Shawn★) :
注册后可以找到,但不知为什么,调用DLL里面的方法,
返回的不是结果集。而只是一个类型。
实例化这个dll中一个类的时候,没问题,也就是说找到了这个类。
但就是里面的内容调用失败了。
为何?
请问,能不能同样调用这个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
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>
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>
SetLastError = true,
ThrowOnUnmappableChar = true)]
说需要标识符,是什么意思? 我这样写怎么出错了。是如何
引用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>
----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>
你明天 加我 381350421 我发你。
风
思归,你可能误解我的意思了,我知道完全可以利用现有的ado.net实现
但是呢。我就是想知道在vb.net写的aspx 如何调用c++写的dll.
[System.Runtime.InteropServices.DllImport("ADODB.dll"])这样写,对不对?
我应该如何写? 非常感谢
已经加你了,查收
Chapter 3: The Essentials for Using COM in Managed Code
http://www.wimdows.net/books/sams/netcominter/067232170x/067232170x_ch03.html
1, 添加引用DLL (必须是.NET的DLL或COM组件(DLL))
2,NEW 一个实例,对实例进行操作。 调用里一个方法是出现:System.Runtime.InteropServices.COMException: java.lang.NullPointerException
为什么?????请思归一定紧跟这个问题。非常感谢。整个项目就卡壳了。
看看你哪儿行不行。好不好。
我真的不行了,项目好紧的。我如何发给你DLL。
就引用,NEW一下。然后调用一个方法。就行了。
看看有没有我这个问题。
这个DLL用在asp里调用是没错的。我如何联系你。留言到我的留言簿里~!!!
非常感谢
这dll谁会用java来写啊。java.lang.NullPointerException????