How to make a search for the two combined tables?

There are two tables that are combined using the query

SELECT disciplina.title, disciplina.kolvo, disciplina.ekzzach, disciplina.uch, disciplina.spec
dis.kursovoi From disciplina Inner Join dis On disciplina.title = dis.title

need to do a search on the joined table

private void search_nazv()
{
try
{
 if (textBox8.Text != string.Empty)
{
 DataSet dataSet = new DataSet();
 BindingSource binding = new BindingSource();

 Poi SqlDataAdapter = new SqlDataAdapter(@"SELECT disciplina.title, disciplina.kolvo, disciplina.ekzzach, disciplina.uch, disciplina.spec 
 dis.kursovoi From disciplina Inner Join dis On disciplina.title = dis.title FROM O. O dis WHERE title LIKE N'%" + this.textBox8.Text + "%'", conpoezdb);
 poi.Fill(dataSet, "dis");
 binding = new BindingSource(dataSet, "dis");
 dataGridView2.DataSource = binding;
}

}
 catch (SqlException sqlExcept)
 { MessageBox.Show(sqlExcept.Message); }
}

 private void search_fio()
{
try
{
 if (textBox8.Text != string.Empty)
{
 DataSet dataS = new DataSet();
 BindingSource binding = new BindingSource();

 Poi SqlDataAdapter = new SqlDataAdapter(@"SELECT disciplina.title, disciplina.kolvo, disciplina.ekzzach, disciplina.uch, disciplina.spec 
 dis.kursovoi From disciplina Inner Join dis On disciplina.title = dis.title disciplina FROM K WHERE K. fio LIKE N'%" + this.textBox8.Text + "%'", conpoezdb);
 poi.Fill(dataS, "dis");
 binding = new BindingSource(dataS, "dis");
 dataGridView2.DataSource = binding;
}
}
 catch (SqlException sqlExcept)
 { MessageBox.Show(sqlExcept.Message); }
}


 private void textBox8_TextChanged(object sender, EventArgs e)
{
 if (comboBox1.Text == "title")
{
 Po SqlConnection = new SqlConnection("Data Source=JUSTYX;Initial Catalog=julia;Integrated Security=True");
 SqlDataAdapter sda = new SqlDataAdapter(@"SELECT title, kolvo, fio, ekzzach uch, spec, kursovoi FROM dis WHERE title like '%" + textBox8.Text + "%' ", po);
 DataTable dt = new DataTable();
sda.Fill(dt);
 dataGridView2.DataSource = dt;
}
 else if (comboBox1.Text == "fio")
{
 Po SqlConnection = new SqlConnection("Data Source=JUSTYX;Initial Catalog=julia;Integrated Security=True");
 SqlDataAdapter sda = new SqlDataAdapter("SELECT title, kolvo, fio, ekzzach uch, spec, kursovoi FROM dis WHERE fio like '%" + textBox8.Text + "%'", po);
 DataTable dt = new DataTable();
sda.Fill(dt);
 dataGridView2.DataSource = dt;
}
 }
July 8th 19 at 16:02
1 answer
July 8th 19 at 16:04
Queries in Hranice and their cause, or EF to use.
Request from two tables: Combine Two Tables in Select statement

Find more questions by tags C#Transact-SQL