大家好,Delphi2006与C#结合使用的问题!!!!

kuiran 2006-01-24 05:02:09
我在Delphi2006中写了一个简单的程序,作了一个Delphi for .net projects中的library
然后用vs.net 中的 C#调用。在Delphi中,我只写了一个数据库Open,Close,和取出所有数据返回到的方法。然后在C#中取出所有记录,显示。
可是我在C#引用的时候,在变量声明部分写了private Library1.Units.Library1 library;
然后在按钮中写了一句
Library1.Units.Library1 library = new Library1.Units.Library1();
可是编译时出现。“类型Library1.Units.Library1未定义构造函数”的错误。
可是在Delphi 的Library中不能写构造函数呀。不知如何可以解决,怎样在.net中调用
Delphi。
如果方便,请将解决方法发送到邮箱:52LKB@163.com中
请各位指教!!
...全文
296 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
NONO_General 2006-01-27
  • 打赏
  • 举报
回复
还要我来回复呀?
NONO_General 2006-01-27
  • 打赏
  • 举报
回复
没有会的吗?
不是吧!!!!
NONO_General 2006-01-27
  • 打赏
  • 举报
回复
顶~~~~~~~~~`
学习一下
kuiran 2006-01-24
  • 打赏
  • 举报
回复
补充一下,部分代码入如下:
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile('mykey.snk')], provided your output
// directory is the project directory (the default).
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile('')]
[assembly: AssemblyKeyName('')]

//
// Use the attributes below to control the COM visibility of your assembly. By
// default the entire assembly is visible to COM. Setting ComVisible to false
// is the recommended default for your assembly. To then expose a class and interface
// to COM set ComVisible to true on each one. It is also recommended to add a
// Guid attribute.
//

[assembly: ComVisible(False)]
//[assembly: Guid('')]
//[assembly: TypeLibVersion(1, 0)]
procedure Open;
begin
DataModule1.ADOQuery1.Open;
end;

procedure Close;
begin
DataModule1.ADOQuery1.Close;
end;
procedure GetRec(arrRec: array of string);
var
iCount: Integer;
begin
DataModule1.ADOQuery1.First;
for iCount := 0 to DataModule1.ADOQuery1.RecordCount - 1 do
begin
arrRec[iCount] := DataModule1.ADOQuery1.FieldByName('UserName').AsString;
DataModule1.ADOQuery1.Next;
end;
end;

begin

end.
这是D中的全部代码

1,979

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 其他语言讨论
社区管理员
  • 其他语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧