-3

Hello I need a help in to use substring in my liq code to get some lent of data which are saved in DB. i want to use in v.Description

v.Description.substring(0,399) something

there is my code

public static string BindeWorkOutDetails(int Id, Label Header, 
                     Label Title, Label Description)
        {
            DataClassesDataContext con = 
                  new DataClassesDataContext(con);
            var q = (from v in con.WorkoutSettings
                     where v.Id == Id
                     select new { v.Header ,v.Title, v.Description, 
                        v.ImageUrl }).First();
            Header.Text = q.Header;
            Title.Text = q.Title;            
            Description.Text = q.Description;
            return q.ImageUrl;
        }

please lest me know how can i use a substring in in Linq please re-code my this code

thank you

4

1 回答 1

3

如果Description是一个字符串,您可以执行以下操作:

v.Description.Substring(0, 399);
于 2013-07-01T13:01:25.933 回答