本文介绍了命令文本,文本框C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

cmd.CommandText = "Select * from Orders2 where ((month([OrderDate])>= '" + textBox1.Text + "') and (year([OrderDate])>= '" + txtyear1.Text + "')) AND ((month([OrderDate])<= '" + textBox2.Text + "') and (year([OrderDate])<= '" + txtyear2.Text + "'));";


我使用上面的命令根据日期在水晶报表中显示了销售额,但是当我输入这些报表时:

textBox1为"12",
txtyear1为"2010",

textBox2为"01",
和txtyear2设为"2011",
水晶报表未显示任何内容.
但是,当我输入以下内容时它会起作用:

textBox1为"11",
txtyear1为"2010",

textBox2为"11"或"12",
和txtyear2设为"2011"


I used the command above to show sales in crystal reports according to date, but when I input these:

textBox1 as "12",
txtyear1 as "2010",

textBox2 as "01",
and txtyear2 as "2011",
the crystal report didn''t show anything.
But, it works when I input:

textBox1 as "11",
txtyear1 as "2010",

textBox2 as "11" or "12",
and txtyear2 as "2011"

what could I do to improve the command without using parameterized query?

推荐答案




这篇关于命令文本,文本框C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 04:34
查看更多