日期:2014-05-17 浏览次数:20827 次
public class SqlHelper
{
private OleDbConnection cn;
public SqlHelper()
{
cn = new OleDbConnection(ConfigurationManager.ConnectionStrings["OleDbConnectionString"].ConnectionString);
cn.Open();
}
public void Close()
{
cn.Close();
}
}
Assembly assembly = Assembly.LoadFrom(@"f:\SqlHelper.dll");
Type type = assembly.GetType("SqlHelper");
object obj = assembly.CreateInstance(type.FullName);
type.GetConstructor(Type.EmptyTypes).Invoke(obj, null);
type.GetMethod("Close").Invoke(obj, null);
Assembly assembly = Assembly.LoadFrom(@"f:\SqlHelper.dll");
Type type = assembly.GetType("SqlHelper");
object obj = assembly.CreateInstance(type.FullName);
type.GetConstructor(Type.EmptyTypes).Invoke(obj, null);
type.GetMethod("Close").Invoke(obj, null);
Assembly assembly = Assembly.LoadFrom(@"f:\SqlHelper.dll");
Type type = assembly.GetType("SqlHelper");
object obj = assembly.CreateInstance(type.FullName);
//type.GetConstructor(Type.EmptyTypes).Invoke(obj, null);
type.GetMethod("Close").Invoke(obj, null);