本文介绍了我的dataGridView重复结果Whay的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码:
This My code:
DataTable dt5 = new DataTable();
string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
using (SqlConnection con = new SqlConnection(CS))
{
string sqlstr5 = "select ipd.FK_Product_id,pt.Product_name,iph.FK_Store_id ,st.Store_name,iph.Invoice_Date,ipd.QTY,ipd.TotalInvoice from InvoicePurchaseHead as iph inner join StoresTBL as st on st.Store_id=iph.FK_Store_id inner join InvoicePurchaseDetails as ipd on ipd.FK_Customers_id=iph.FK_Customers_id inner join Products_TBL as pt on pt.Product_id=ipd.FK_Product_id WHERE ipd.FK_Product_id = @FK_Product_id and iph.Invoice_Date = DATEADD(DAY, DATEDIFF(DAY, 0, GETDATE()), 0)";
using (SqlDataAdapter dr7 = new SqlDataAdapter(sqlstr5, CS))
{
dr7.SelectCommand.Parameters.AddWithValue("@FK_Product_id", txtProductId.Text );
dr7.Fill(dt5);
dataGridView1.DataSource = dt5;
}
}
推荐答案
这篇关于我的dataGridView重复结果Whay的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!