gpt4 book ai didi

mysql - “SELECT * FROM book WHERE year=wyear AND account >= waccount1 AND account <= waccount1”

转载 作者:行者123 更新时间:2023-11-29 09:59:59 29 4
gpt4 key购买 nike

几天来,我一直在努力显示数据集中表中的数据。当我不在 WHERE 中放置条件时,它会显示完整的表,但只需要表中满足条件的行。如果有更快查看的建议。多谢。

myConnectionString = pwput;
MySqlConnectionconpara = new MySql.Data.MySqlClient.MySqlConnection();
conpara.ConnectionString = myConnec DataSetionString;
try
{
conpara.Open();
if (conpara.State == ConnectionState.Open)
{
string waccoun1 = wnalog1.ToString();
string waccoun2 = wnalog2.ToString();
stringnupita = "SELECT * FROM book WHERE year=wyear AND account >=
waccount1 AND account <= waccount1";
MySqlCommandcmdnal = new MySqlCommand(nupita,conpara);
MySqlCommand(nupita,conpara);cmdnal.Parameters.AddWithValue("@year",
wyear);
MySqlDataAdapte radda = new MySqlataAdapter(cmdnal);
MySqlCommandBuildercbb = new MySqlCommandBuilder(adda);
DataSet dsd = new DataSet();
adda.Fill(dsd, "book");
conpara.Close();
if (dsd != null)
{
dataGridView1.DataSource = dsd;
dataGridView1.DataMember = "book";
Font = new System.Drawing.Font("Arial Unicode", 7);
dataGridView1.Font = Font;
{

最佳答案

您需要使用如下参数:

...

stringnupita = "SELECT * FROM book WHERE year=@year AND account >=
@waccount1 AND account <= @waccount2";
MySqlCommand(nupita,conpara);cmdnal.Parameters.AddWithValue("@year",
wyear);
MySqlCommand(nupita,conpara);cmdnal.Parameters.AddWithValue("@waccount1",
waccount1);
MySqlCommand(nupita,conpara);cmdnal.Parameters.AddWithValue("@waccount2",
waccount2);
...

关于mysql - “SELECT * FROM book WHERE year=wyear AND account >= waccount1 AND account <= waccount1”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53209677/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com