本文介绍了sql查询中的笛卡尔积 - c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好。 我在C#中遇到sql查询问题:(。 这里是代码:
Hello guys. I have a problem with the sql query in C# :(. here is the code:
dts.Tables.Clear(); SqlDataAdapter da = new SqlDataAdapter("SELECT t.Date, t.Barcode, t.Name, t.Quantity, d.BuyPrice, t.SellPrice FROM tblSales t, tblMagazine d WHERE t.Date BETWEEN '" + DateTimePicker1.Value + "' AND '" + DateTimePicker2.Value + "'", con); da.Fill(dts); dataGridView1.DataSource = dts.Tables[0];它给了我笛卡尔积或类似的东西....因为当我点击按钮(有这个代码)它向我展示了比表Sales中更多的表格。 有什么问题?有人可以帮我吗
It gives me cartesian product or something like that.... because when I click the button (that has this code) it shows me more tables than I have in the table Sales. What is the problem ?? Can someone help me
推荐答案tblSales 和 tblMagazine 没有共同点...你对笛卡儿是正确的; 销售与杂志之间的联系是什么,因为这个缺失。 tblSales and tblMagazine don''t have something in common... you''re right about the cartesian; What''s the link between Sales and Magazine, due this one''s missing.
更多推荐
sql查询中的笛卡尔积
发布评论