There is a DataGridView, a data source is connected to it, I make a request to fetch data from a database table.
private void button4_Click(object sender, EventArgs e) { SqlConnection Search_connection = new SqlConnection("....."); SqlCommand Search_command = new SqlCommand(); Search_command.CommandType = CommandType.Text; Search_command.CommandText = "SELECT * from [dbo].[rukovod] where concat(F_R,I_R,O_R) like @str"; Search_command.Parameters.AddWithValue("@str", "%" + textBox4.Text + "%"); Search_command.Connection = Search_connection; Search_connection.Open(); Search_command.ExecuteNonQuery(); Search_connection.Close(); this.rukovodTableAdapter.Fill(this.stroitelnayaFirma_DBDataSet.rukovod); } The table is updated, but the data remains the same as it was.
I drove Query request to Managment Studo, everything works there.
How can I make it so that only the result of the query is displayed in the dataGridView?
rukovodis a rather specific coding style that makes reading the code more difficult. Usually so try not to do. ) - Nick Volynkin ♦