"SELECT * FROM bill WHERE year=wyear AND account >= waccount1 AND account <= waccount2";
Posted by: RADE MIH
Date: October 30, 2018 04:57AM

I am new to work with mysql 5.7.21 and c # and vs2015. How to display the rows from the BILL table in DataSet. When I do not put a condition in the WHERE, it shows me a complete table, but I need only some rows.

myConnectionString = pwput;
MySqlConnectionconpara = new MySql.Data.MySqlClient.MySqlConnection();
conpara.ConnectionString = myConnec DataSetionString;
try
{
conpara.Open();
if (conpara.State == ConnectionState.Open)
{
string waccount1 = wwaccount1.ToString();
string waccount2 = wwaccount2.ToString();
string upita = "SELECT * FROM bill WHERE year=wyear AND account >= waccount1
AND account <= waccount2";
MySqlCommandcmdnal = new MySqlCommand(nupita, con);
cmdnal.Parameters.AddWithValue("@year", wyear);
MySqlDataAdapte radda = new MySqlDataAdapter(cmdnal);
MySqlCommandBuilder cbb = new MySqlCommandBuilder(adda);
DataSet dsd = new DataSet();
adda.Fill(dsd, "bill");
conpara.Close();

if (dsd != null)
{
dataGridView1.DataSource = dsd;
dataGridView1.DataMember = "bill";
Font = new System.Drawing.Font("Arial Unicode", 7);
dataGridView1.Font = Font;

Options: ReplyQuote


Subject
Written By
Posted
"SELECT * FROM bill WHERE year=wyear AND account >= waccount1 AND account <= waccount2";
October 30, 2018 04:57AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.