User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 391,584 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,650 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 248 | Replies: 6 | Solved
Reply
Join Date: May 2008
Posts: 23
Reputation: fayenot is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
fayenot fayenot is offline Offline
Newbie Poster

Filtering in SQL

  #1  
Jun 2nd, 2008
Scenario: I have 2 gridviews, clientgridview for showing the clients and the projectgridview for showing the projects. If I Click on the Client name on the the clientgridview i will be directed to the project gridview to show the different projects of the client

Problem: when i click on the name of my client, projectgridview displays all the projects that are stored on my database. I need to display only the projects that are associated to the selected client(ProjectId is the PK in m ProjectTable and is FK in ClientTable).

Can anyone help me get the corrent syntax to filter the projectId...
SELECT * FROM Project WHERE ProjectId=@Project;
I used this syntax and it didnt work..hope you guys can figure out how to filter this correctly..
Last edited by fayenot : Jun 2nd, 2008 at 3:06 am.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2008
Posts: 39
Reputation: srikanthkadem is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 7
srikanthkadem srikanthkadem is offline Offline
Light Poster

Re: Filtering in SQL

  #2  
Jun 2nd, 2008
hi,
in projects table there should be a coloumn like clientid.so if u click on client naem just pass client id.and write query like this

 select * from project where clientid=@clientid
...so this will filter the projects according to client.hope this wil help you,.thanking you.
Reply With Quote  
Join Date: May 2008
Posts: 23
Reputation: fayenot is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
fayenot fayenot is offline Offline
Newbie Poster

Re: Filtering in SQL

  #3  
Jun 2nd, 2008
hi there..
thanks for the reply but unfortunately it didnt work for me..i believe there still a code that needs to be added on the selecting event of the datasource(that's only my opinion) but if you guys have some different idea aside from using a sql syntax please feel free to reply in this post...thanks
Reply With Quote  
Join Date: Mar 2008
Posts: 39
Reputation: srikanthkadem is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 7
srikanthkadem srikanthkadem is offline Offline
Light Poster

Re: Filtering in SQL

  #4  
Jun 3rd, 2008
hi,
can u post ur code ,so that we can understand what u r trying to do.
thanking you,
Reply With Quote  
Join Date: May 2008
Location: Chennai
Posts: 39
Reputation: rajarajan07 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 3
rajarajan07's Avatar
rajarajan07 rajarajan07 is offline Offline
Light Poster

Re: Filtering in SQL

  #5  
Jun 3rd, 2008
Ur coding is right!, but you need to pass the correct client id to the variable @project, I want to know the structure of your master and child table.
If you got your answer, please mark the thread as Solved.
Thanks & Regards,
RajaRajan. R

rajarajan07@rediffmail.com
Reply With Quote  
Join Date: May 2008
Posts: 23
Reputation: fayenot is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
fayenot fayenot is offline Offline
Newbie Poster

Re: Filtering in SQL

  #6  
Jun 3rd, 2008
hi srikanthkadem....
my problem is already resolved, thanks for trying to help i appreciate it.. i already figured it out through tutorials in the web... till next time..
Reply With Quote  
Join Date: May 2008
Posts: 23
Reputation: fayenot is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
fayenot fayenot is offline Offline
Newbie Poster

Re: Filtering in SQL

  #7  
Jun 3rd, 2008
hi rajarajan07...
thanks for replying but i already got a solution to the problem.. i only set some of the properties of the gridview to make it work...till next time..
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ASP.NET Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 10:58 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC