我有两张表产品和购买
Product
Item_Code Item_Name Packing MRP
1 PANADOL TAB 1*200 200
2 PARACETAMOL TAB 1*50 200
3 CALPOL SYP 2*5 5
4 AUGMENTIN DROP 1*500 234
5 DISPRIN 10*60 14
6 NUBEROL FORT 5*20 245
7 PANADOL SYP 6*9 123
8 NORAN 20 CAP 1*5 765
9 CLARITEK DROP 2*9 45
10 NIVAQUIN P SYP 3*6 34
Purchase
Pur_Invoice_No Item_Code Pur_Item_PackQuantity
1 1 3
2 1 9
2 2 3
2 2 3
3 1 9
3 3 3
3 9 3
3 4 3
6 4 14
现在我想从Product表和Pur_Item_PackQuantity(来自购买表的colomn)agianst Item_Name中获取所有Item_Name,但是只显示了在Purchase表中存在的Item_Name,而不是使用以下Method给出的所有item_Name。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mateenwin
{
public partial class SumSaleQuantity : Form
{
public SumSaleQuantity()
{
InitializeComponent();
purchaseQuantity_Bind();
PurchaseInvoice_Bind();
PurchaseNameQuantity_Bind();
}
public void PurchaseNameQuantity_Bind()
{
string query = "SELECT Product.Item_Name,Packing,MRP,SUM(Purchase.Pur_Item_PackQuantity) FROM Product RIGHT JOIN Purchase ON Product.Item_Code = Purchase.Item_Code Group By Item_Name,MRP,Packing ORDER BY Item_Name ";
SqlConnection newcon = new SqlConnection("Data Source=.;Initial Catalog=mateenwin;User ID=sa;Password=123");
SqlCommand newcommand = new SqlCommand(query, newcon);
SqlDataAdapter dp = new SqlDataAdapter(newcommand);
DataTable dttt = new DataTable();
dp.Fill(dttt);
dataGridView3.DataSource = dttt;
}
private void SumSaleQuantity_Load(object sender, EventArgs e)
{
}
}
}
请帮助解决此问题