Note that there are some explanatory texts on larger screens.

plurals
  1. POSearch page to search from multiple tables
    text
    copied!<p><br> I have a basic search page to search for Employee's skill.<br></p> <p>There is a bridge table between dbo.Emp and dbo.Skill table called 'Dbo.Emp_skill_Bridge'. <br></p> <p>This is what I have done so far that allows to search only the bridge table. <br></p> <p>Example: I need to type in "2" to get Employee's details and only from this table. I have Skill to be typed like "java" and get list of employees from Emp table.</p> <pre><code>dbo.Emp_Skill_Bridge SkillID (FK) | EmpID (FK) dbo.Skills SkillName | SkillID(PK) dbo.Emp EmpID (PK) | Fname| LName | ..... </code></pre> <p>So I need to search for skills from Skills and get precise Employees' details.<br> <strong><em>Updated:</em></strong> </p> <pre><code>protected void Button1_Click(object sender, EventArgs e) { String var2 = System.Configuration.ConfigurationManager.ConnectionStrings["KKSTechConnectionString"].ConnectionString; SqlConnection con = new SqlConnection(var2); //SqlCommand cmd = new SqlCommand("select * from Emp_Skill_Bridge where SkillID like '%" + TextBox1.Text + "%' ", con); SqlCommand cmd = new SqlCommand("SELECT * FROM Emp_Skill_Bridge ESB INNER JOIN Emp E ON E.EmpId = ESB.EmpId INNER JOIN Skills S ON S.SkillID = ESB.SkillID WHERE ESB.SkillID LIKE '%" + TextBox1.Text + "%' OR ESB.SkillID LIKE '%" + TextBox1.Text + "%'", con); //string val = TextBox1.Text.ToString(); con.Open(); cmd.ExecuteNonQuery(); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = cmd; DataSet ds = new DataSet(); da.Fill(ds, "Emp"); GridView1.DataSourceID = null; GridView1.DataSource = ds; GridView1.DataBind(); con.Close(); } </code></pre> <p>The code is working but not the GridView is not showing the data.. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload