小编Sha*_*jar的帖子

类型'System.Int32'的表达式不能用于方法'Boolean Equals(System.Object)'的'System.Object'类型的参数

我有一个共同的网格视图柱过滤方法与的ColumnName和SEARCHTEXT明智滤波器网格视图记录.在这里,当我在可空INT DataColumn的操作也有像这个方法抛出错误:

类型'System.Int32'的表达式不能用于方法'Boolean Equals(System.Object)'的'System.Object'类型的参数

我的方法代码是:

 public static IQueryable<T> FilterForColumn<T>(this IQueryable<T> queryable, string colName, string searchText)
{
    if (colName != null && searchText != null)
    {
        var parameter = Expression.Parameter(typeof(T), "m");
        var propertyExpression = Expression.Property(parameter, colName);
        System.Linq.Expressions.ConstantExpression searchExpression = null;
        System.Reflection.MethodInfo containsMethod = null;
        // this must be of type Expression to accept different type of expressions
        // i.e. BinaryExpression, MethodCallExpression, ...
        System.Linq.Expressions.Expression body = null;
        Expression ex1 = null;
        Expression ex2 = null;
        switch (colName)
        {
            case "JobID":
            case "status_id": …
Run Code Online (Sandbox Code Playgroud)

.net c# linq linq-expressions

9
推荐指数
1
解决办法
2万
查看次数

非静态字段,方法或属性'System.Web.UI.Page.Request.get'需要对象引用

我正在使用网络应用程序.我在编译期间发现了错误.此代码中发生此错误:

public static void SendRegistrationEmail(string name, string ref_no, string email)
    {
        MailMessage msg = new MailMessage();
        msg.IsBodyHtml = true;
        SmtpClient client = GetSmtpClient();
        string fromEmailAddress = ConfigurationManager.AppSettings["EASYTRACK_FromEmailAddress"];
        string appPath = ConfigurationManager.AppSettings["EASYTRACK_PathToApplication"];
        string subject = "EASYTRACK | User Registration";
        string body = "<html><body>Thank you " + name + " !" +
                    " for registering your details with Easy Track.<br/><br/>" +
                    "Please click the following link to activate your account" +
                    "<br /><a href = '" + Request.Url.AbsoluteUri.Replace("Register.aspx", appPath + "My_Account.aspx?Ref=" + …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-4.0

1
推荐指数
1
解决办法
6980
查看次数

标签 统计

c# ×2

.net ×1

asp.net-4.0 ×1

linq ×1

linq-expressions ×1