LINQ ExecuteQuery - Error

I have a problem with Executequery: Error message: "The specified order is invalid." I tried:

var qq = db.ExecuteQuery<class_search>(query, ddl4, ddl5, ddl1).ToList();

But the same mistake, too. I tried several more times. Always this error or "Query results cannot be listed more than once" when I tried to make IEnumerable. I have read many articles, but I do not know how to do this. What am I doing wrong or missing?

public class class_search
{
    public string path_image
    { get; set; }

    public string name_product
    { get; set; }

    public float cost
    { get; set; }
} 

public partial class Search : System.Web.UI.Page
{
    DataClasses1DataContext db = new DataClasses1DataContext();

    string ddl4 = DropDownList4.SelectedItem.Value;
    string ddl5 = DropDownList5.SelectedItem.Value;
    string ddl1 = DropDownList1.SelectedItem.Value;

    string query = "select p.path_image, p.name_product, p.cost from Table1 a, Table2  p, Table3 k where a.column1 = {0} and a.column2 = {1} and k.column2 = {2} and p.IDForeignColumn1 = k.IDcolumn and p.IDForeignColumn2 = a.IDcolumn"

    var qq = db.ExecuteQuery<class_search>(query, ddl4, ddl5, ddl1);

    ListView1.DataSource = qq;
    ListView1.DataBind();
}

// I changed the code to English. Now a.column1, a.column2 and k.column2 are string types.

+5
source share
3 answers

Try it IEnumerable<class_search> qq = db.ExecuteQuery<class_search>(query, ddl4, ddl5, ddl1).ToList();and see if that helps.

, nitpick, var , . , , .

, , , , .

0

FLOAT SQL .Net CLR, . , float SQL LINQ-to-SQL. , class_search.cost class_search.

: search_class :

public class class_search
{
    public string path_image
    { get; set; }

    public string name_product
    { get; set; }

    public double cost
    { get; set; }
} 
0

Clr DateType Sql Db Type. sql select dbml.

The linq to sql dbml autocard mechanism correctly solves the choice of target and source types. And use the drag-and-drop view class in your POCO code in yourdbml.designer.cs and enjoy it.

0
source

All Articles