Click here to Skip to main content
15,894,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

my gridview is not showing data,
i checked with breakpoints, datatable is showing data but gridview is not showing,.query is correct, runed on Mysql workbench.it's winforms application.

C#
<pre lang="c#"> using (MySqlConnection con = new MySqlConnection(ConnectionString))
            {
                String query = "select * from transaction where DATE(paid_date)BETWEEN '" + fromdate + "'AND'" + todate + "' AND(customer_id='" + customer + "' OR card_id='" + card + "')";
                con.Open();
                MySqlDataAdapter da = new MySqlDataAdapter(query, con);
                DataTable dt = new DataTable();
                da.Fill(dt);
                dataGridView1.DataSource = dt;
                //dataGridView1.DataBind();
Posted
Comments
Krunal Rohit 19-Feb-14 0:07am    
Repost !
-KR
The14thNoah 19-Feb-14 0:14am    
can you show your mark-up for your datgrid?

dataGridView1.AutoGenerateColumns = true;

da.Fill(dt);
dataGridView1.DataSource = dt

check with this
 
Share this answer
 
v2

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