sql查询中的笛卡尔积

编程入门 行业动态 更新时间:2024-10-25 12:23:44
本文介绍了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查询中的笛卡尔积

本文发布于:2023-11-30 12:04:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1649884.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:笛卡尔   sql

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!