c# - Query returns results 5 times -


I have a strange problem: The result of my query in C # / ASP.NET returns is 5 times. I tried BreakPoint-ing but I could not find the error. I have 2 related tables, one table is loaded on PAGE_LOAD and when the user clicks on a cell, it shows the content from another table related to that cell. It is very easy.

  // page load safety Pej_lod (object sender, Event agents e) {if (! IsPostBack) {OleDbConnection myConnection = New OleDbConnection ( "Provider = Microsoft.Jet.OLEDB 4.0; Data Source = "+ DBPit +" /secure_user/data/data.mdb "); OleDbDataAdapter adapter = new OleDbDataAdapter ( "Select project manager, client, project deadlines where username = '" + Anam + "' My connection); Detatayl table = new Detatale (); adapter.Fill (table) ; adapter.Dispose (); GridView1.DataSource = table; does GridView1.DataBind ();}}  

now when I click on a particular project, it loads Gridwu projects table I'll show more information about the project:

  Protected void selected Gridwu 1 the index (object sender, Iventargs e) {GridViewRow row = GridView1.SelectedRow; Label1.Text = row.Cells [1]. Text; OleDbConnection myConnection = new OleDbConnection ( "Provider = Microsoft.Jet. OLEDB.4.0; data source = "+ dbpath +" / Surkshit_usr / data / data.  
mdb "); select OleDbDataAdapter adapter = new OleDbDataAdapter (" task. task, action Functions, tasks, tasks, tasks, tasks where the user name = '"+ uname +"' and taskss.Project = '"+ Label1.Text +"' ", My connection); Datatyal table = new datatelle (); Adapter.Fill (table); Adapter.Dispose (); GridView2.DataSource = Table; GridView2.DataBind (); GridView2.Visible = true; }

It does not imply an error, but it 5 times does not matter I choose what project GridView1 do, it is always 5 times Gridwu 2 (second table in a row ) What content does the content show?

It seems that there is something wrong with your query instead try using inner join, .

Instead, select

  instead. Tasks, tasks Priority, work Don, Task. Tasks.Username = '"+ uname +"' and taskss.Project = '"+ Label1.Text +"'  

Try it out:

Pre> SELECT functions. Tasks, tasks Priority, work Don, Task. Join projects in projects with projects. Id = work Project - & gt; WHERE tasks.Username = '"+ uname +"' and work depends on your table structure. Project = '"+ Label1.Text +"'

One more thing: Building is prone to a SQL query.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -