我想使用 System.Reflection 的 MethodInfo 和 MethodBody 类调用一个方法,并且该方法的名称和主体在 sql server 中我该怎么做,请帮忙
SqlConnection con = new SqlConnection(GlobalData.GetConnectionString());
SqlCommand cmd = new SqlCommand("select CodeSnippet from SubMenu where Role_ID='"+GlobalData.RoleID+"' and ChildMenu='"+sender.ToString()+"'", con);
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlDataReader reader = cmd.ExecuteReader();
if (reader.Read())
{
string codeSnippet = reader["CodeSnippet"].ToString();
Type type = typeof(Helper);
MethodInfo method = type.GetMethod(codeSnippet);
Helper c = new Helper();
method.Invoke(c, null);
}
if (con.State == ConnectionState.Open)
{
con.Close();
}
我已经完成了,现在我想要来自 microsoft sql server 的方法体