C#生成com组件,供asp调用
C#生成com组件,供asp调用
一、vs2005—新建项目—C#类库
类库源码如下(包含接口,类,事件接口):
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Data.SqlClient;
using System.Runtime.InteropServices;
namespace entryclass
{
//Guid值的产生:Program FilesMicrosoft Visual Studio 8Common7Toolsguidgen.exe,运行它,选中单选4,点“New Guid”,点“Copy”,进入类库,粘贴即可
//类接口
[Guid("F2257E71-ECC9-47ef-A065-F5B530F24B07")]
public interface ini_mng_Interface
{
[DispId(1)] //固定写法,索引号从1开始
string ini_dme(string entryuser, string entrypass, string agentname, string agentpass, string constr);
[DispId(2)]
string ini_svr(string entryuser, string entrypass, string agentname, string agentpass, string constr);
}
// 事件接口
[Guid("45875EE5-5C8D-4016-897A-FCC7DD5A6834"), //固定写法
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ini_mng_Events
{
}
//类
[Guid("8EDFA9EA-9589-4157-AEEF-AB4861EFE5D6"), //固定写法
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(hst_odr_Events))]
public class ini_mng : ini_mn
相关文档:
在 .NET 里面使用 SQLite, 我这里使用的wrapper是 System.Data.SQLite,它只需要一个dll,接口符合ADO.Net 2.0的定义,性能也不错,NHibernate用的也是它,目前支持ADO.NET 3.5了,支持集成在 VS2005 和 VS2008里面,而且支持wince,是个亮点
因为符合ADO.NET的规范,所以使用方式,基本和 SqlClient, OleDb等原生的一致
us ......
C#代码与javaScript函数的相互调用
问:
1.如何在JavaScript访问C#函数?
2.如何在JavaScript访问C#变量?
3.如何在C#中访问JavaScript的已有变量?
4.如何在C#中访问JavaScript函数?
问题1答案如下:
javaScript函数中执行C#代码中的函数:
方法一:1、首先建立一个按 ......
Unix时间戳最小单位是秒,开始时间为格林威治标准时间1970-01-01 00:00:00
ConvertIntDateTime方法的基本思路是通过获取本地时区表示Unixk开始时间,加上Unix时间值(即过去的秒数).
ConvertDateTimeInt方法的基本思路是通过刻度数差,再把刻度数转换为秒数,当然要说明的是,我这里返回的是double类型,意义上并非是真 ......
在web程序中,经常会使用在一个网页使用其他网页提交的数据信息,这里可以使用Request内置对象来完成,来获取用户提交的信息,根据客户端提交数据方式的不同,Request对象分别使用Form和QueryString集合属性来获取数据。下面是两种集合获取方式的不同点:通过Form获取数据时在form属性中简单的添加action=“跳转的网页 ......
从字符串中返回指定数目的字符。
Mid(string, start, length)
参数
string
字符串表达式,从中返回字符。如果 string 包含 Null,则返回 Null。
Start
string 中被提取的字符部分的开始位置。如果 start 超过了 string 中字符的数目,Mid 将返回零长度字符串 ("")。
Length
要返回的字符数。如果省 ......