Click here to Skip to main content
15,887,337 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
plz help...
I need to make conditional search from a filled data set using linq and need to display it in a grid...
Here s my code

MySqlConnection db = new MySqlConnection("Database=loyaltycard;Data Source=localhost;User Id=root;Password=root");
db.Open();
MySqlDataAdapter da = new MySqlDataAdapter();
MySqlCommand c = new MySqlCommand("select SupplierId,SupplierCode,CompanyId,SurName from supplier", db);
da.SelectCommand = c;
DataSet ds = new DataSet();
da.Fill(ds);

var products = from p in ds.Tables[0].AsEnumerable() where p.Field<string>("SupplierCode").ToString() == "12" select p;
GridView1.DataSource = products.ToList();
GridView1.DataBind();
db.Close();
---------------------------------
I cant get the data from linq query and bind it 2 grid...someone please guide me.......
Posted
Updated 25-Nov-11 20:19pm
v5

Without looking at your code, its may not be possible to provide you exact solution.

Have a look at below link for "LINQ to DataSet".

Querying DataSets – Introduction to LINQ to DataSet

Below link will provide you idea about "Asp.Net GridView Data Binding".

http://wiki.asp.net/page.aspx/804/binding-grid-view-control/

Edit - Have a look at below link for similar discussion.

http://forums.asp.net/t/1150810.aspx/1
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900