Click here to Skip to main content
15,882,114 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all.

I am new in windows application development.

I want to bind the data in gridview's DataGridViewTextBoxColumn

C#
private void Form1_Load(object sender, EventArgs e)
        {
            cn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\Bill\\dbBill.accdb");
            string query = "Select Sr,Desc,HSNCode,Qty,Rate,Qty*Rate as Amount from BillDetail";
            cn.Open();
            cmd = new OleDbCommand(query, cn);
            da = new OleDbDataAdapter(cmd);
            ds = new DataSet();
            da.Fill(ds);
            cn.Close();


            grdDetails.DataSource = ds;
            
            


        }


I have set the property DataPropertyName also but still not getting the record.

Please help me.

Thanks in advance
Posted

1 solution

hi, Riyaz

---I think this is helpful for you
---Gridview DataPropertyName should same as field name that given in Quary
 
Share this answer
 

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