Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 build query for checkbox selected

Author  Topic 

bplvid
Starting Member

45 Posts

Posted - 2012-05-04 : 18:11:12
I need to display all the data's of a particular user in a gridview at the same time I need to check the checkbox that matches the data based on item.for Eg. I've a table with some data's that belongs to a particular user(Many(data's) to one(user) realtionship).My item table that belongs to that user references to these data's.What I need is i need to display all the data's and have the checkbox value checked for those data's that have reference to item table.
Hope I din't confuse my question..

I need the approach that i should follow.Any suggestion is much appreciated.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-04 : 18:15:29
this is something you need to do at your front end. You just need to include bit fields or attributes for various data against the user in sql table. Then in front end application you need to retrive the details of user using a select query/procedure based on user parameter and the use this data to show the checkbox status

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

bplvid
Starting Member

45 Posts

Posted - 2012-05-04 : 19:15:08
quote:
Originally posted by visakh16

this is something you need to do at your front end. You just need to include bit fields or attributes for various data against the user in sql table. Then in front end application you need to retrive the details of user using a select query/procedure based on user parameter and the use this data to show the checkbox status

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/






I'm not sure how to handle this scenario.I can do a select statement on my data table based on userid but how do i handle retriving data's that are holding references from item table still displaying all the data's aswell. one user can have one or more datas, one item can be related to any no. of datas or even be null .

Data table

dataid
dataname
itemid
userid

item table

itemid
item name


Sorry if I wasn't clear with my question















Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-04 : 19:58:10
as per current table structure it will be a simple join between them on itemid column and then filter on userid field for getting required user data

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -