Click here to Skip to main content
16,015,991 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi..

I am creating Window Application. Using Dataset completely Gird Fill But Problem is that Record Is more than 20 lakh.

So Please Tell Me How To use The Fill GridView Using SqlDataReader.

I am Creating one Method in Class File then create Object of the class File Then use object..

Which are As under...
public void gridview1(DevExpress.XtraGrid.GridControl grid1, string query)
{
SqlConnection connection = new SlConnection(Connectionstring);
connection.Open();
SqlDataReader reader;
reader = new SqlCommand(query, connection).ExecuteReader();
reader.Read();
grid1.DataSource = reader;
grid1.DataBindings; // Here Error occur. 
connection.Close();
}

My class Object.
program obj = new program()
string query=".....";
obj.gridview1(grd,query); 


P/S: I searched on google for many days, but i still not find answer exactly.
Please help me!!!

I'm sorry, my english is not good. So difficult to explain more clearly.
Hope you try to help me.

Thanks..
Chirag
Posted
Updated 8-Feb-11 21:28pm
v5

1 solution

Instead of:
grid1.DataBindings; // Here Error occur. 


Try:
grid1.DataBind();
 
Share this answer
 
Comments
ChiragBMakwana 9-Feb-11 2:30am    
Grid.DataBind(); Method Is Not Available
Sandeep Mewara 9-Feb-11 2:33am    
Ah! You are using GridControl which is WRONG. Use 'GridView' and it should do.
ChiragBMakwana 9-Feb-11 2:37am    
But It is a DevExpress.XtraGrid.GridControl.
It's Work On DataSet. not In SqlDataReader.
Sandeep Mewara 9-Feb-11 2:38am    
Well, if thats so and documented then why trying
karthi Murugesan 18-Mar-14 5:35am    
some times grid1.DataBind(); will not appear..
instead of that use like below may its solve ur problems

grid1.DataBindings.ToString();

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