如何在Windows应用程序中的DataGridViewTextBoxColumn中绑定gridview中的数据 [英] How to bind data in gridview in DataGridViewTextBoxColumn in windows application
本文介绍了如何在Windows应用程序中的DataGridViewTextBoxColumn中绑定gridview中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好。
我是Windows应用程序开发的新手。
我想绑定gridview的DataGridViewTextBoxColumn中的数据
Hi all.
I am new in windows application development.
I want to bind the data in gridview''s DataGridViewTextBoxColumn
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;
}
我设置了属性DataPropertyName但是仍然没有得到记录。
请帮帮我。
提前致谢
I have set the property DataPropertyName also but still not getting the record.
Please help me.
Thanks in advance
推荐答案
Riyaz
---我认为这对你有帮助
--- Gridview DataPropertyName应与Quary中给出的字段名称相同
Riyaz
---I think this is helpful for you
---Gridview DataPropertyName should same as field name that given in Quary
这篇关于如何在Windows应用程序中的DataGridViewTextBoxColumn中绑定gridview中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文