Note that there are some explanatory texts on larger screens.

plurals
  1. POQuery returns results 5 times
    text
    copied!<p>I have a weird problem. My query in C#/ASP.NET returns results 5 times. I tried brakepoint-ing but I can't find the error. I have 2 related tables. One table loads on PAGE_LOAD and when the user click on a cell, it shows the content from another table related to that cell. It's very simple.</p> <pre><code> //PAGE LOAD protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dbpath + "/secure_user/data/data.mdb"); OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT Project,Manager,Customer,Deadline FROM projects WHERE Username='" + uname + "'", myConnection); DataTable table = new DataTable(); adapter.Fill(table); adapter.Dispose(); GridView1.DataSource = table; GridView1.DataBind(); } } </code></pre> <p>It loads projects table to the GridView. Now when I click a certain project, it displays more information about that project:</p> <blockquote> <pre><code>protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { GridViewRow row = GridView1.SelectedRow; Label1.Text = row.Cells[1].Text; </code></pre> </blockquote> <pre><code> OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dbpath + "/secure_user/data/data.mdb"); OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT tasks.Task,tasks.Priority,tasks.Done,taska.Hours FROM projects,tasks WHERE tasks.Username='" + uname + "' AND tasks.Project='" + Label1.Text + "'", myConnection); DataTable table = new DataTable(); adapter.Fill(table); adapter.Dispose(); GridView2.DataSource = table; GridView2.DataBind(); GridView2.Visible = true; } </code></pre> <p>It displays with no error, but it does 5 times no matter what project I select from GridView1, it always displays GridView2 (second table) content 5 times in a row. What could be the problem?</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