Private void
Button2_click(object sender,EventArgs e)
{
Byte[] result = null;
String dsn = “”;
SqlConnection con = new SqlConnection(dsn);
{
Byte[] result = null;
String dsn = “”;
SqlConnection con = new SqlConnection(dsn);
Con.open();
Sqlcommand cmd= new SqlCommand(“select * from StoredDLL”,con);
cmd.CommandType = CommandType.Text;
SqlDataReader reader = cmd.ExecuteReader();
If(reader.HasRows)
{
While(reader.Read())
{
resullt = (Byte[])reader[0];
}
File.WriteAllBytes(@”D:\som\Test1.dll”,result);
Object results = ReadandAccessDLL();
Messagebox.show(result.tostring());
}
Else
{
Messagebox.show(“No Rows found”);
}
Reader.close();
Con.close();
}
Sqlcommand cmd= new SqlCommand(“select * from StoredDLL”,con);
cmd.CommandType = CommandType.Text;
SqlDataReader reader = cmd.ExecuteReader();
If(reader.HasRows)
{
While(reader.Read())
{
resullt = (Byte[])reader[0];
}
File.WriteAllBytes(@”D:\som\Test1.dll”,result);
Object results = ReadandAccessDLL();
Messagebox.show(result.tostring());
}
Else
{
Messagebox.show(“No Rows found”);
}
Reader.close();
Con.close();
}
Private object ReadandAccessDLL()
{
Assembly a=Assembly.LoadFile(@”D:\som\Test1.dll”);
Object result = null;
For each (Type type in a.GetTypes())
{
If(type.IsClass== true)
{
If( type.FullName.EndsWith(“.” + “class1”))
{
Object obj = Activator.CreateInstance(type);
Object[] args = {56,86};
Result = type.InvokeMember(“sum”,
BindingFlags.Default|BindingFlags.InvokeMethod,null,obj,agrs);
}
}
}
Return result;
}
{
Assembly a=Assembly.LoadFile(@”D:\som\Test1.dll”);
Object result = null;
For each (Type type in a.GetTypes())
{
If(type.IsClass== true)
{
If( type.FullName.EndsWith(“.” + “class1”))
{
Object obj = Activator.CreateInstance(type);
Object[] args = {56,86};
Result = type.InvokeMember(“sum”,
BindingFlags.Default|BindingFlags.InvokeMethod,null,obj,agrs);
}
}
}
Return result;
}
No comments:
Post a Comment