Click here to Skip to main content
15,906,323 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HI,

i have 2 tables like tbl_userprofile,tbl_images.
in tbl_userprofile page there are 5 colums are there,
1.name,2.email,3.pwd,4.friends,and 5.location

tbl_images page there are 4 columns are there

1. imageid, 2. Image name, 3. Location, 4. share

for sharing i am using checkbox in asp.net, if i want to share photos to my friends i will checked that check box. that images will display the user profile page.
can u please suggest me the any idea for to do this.

please help me write query in sql and asp.net code for to shate photos to friens..
Posted

1 solution

You should have an ID column in table tbl_userprofile, which should be UserID.

For Sharing Images
Make another table tbl_sharedImages.
Columns will be like below.

1. imageID - ID of image from table tbl_images
2. sharedBy - UserID of user who is sharing, in your terms checking the checkbox.
3. sharedTo - UserID of friends you want to share. You can use this column for custom sharing or can remove this column if not needed. I mean if you want the picture to be shown to all then don't use it, if you have some options for custom sharing, then you have to store the UserIDs to which you want to share.
4. sharedDate - Date and Time when the picture is shared.
5. modifiedDate - If any modification is done to the shared picture.
6. isDeleted - extra column for checking the existence of row. Default is 0 always.

This is the most simple implementation. This can be modified according to your requirements. But this is the concept which you can apply.
Please check and let me know if any questions.

[update]

New requirement of Album Sharing

For Album Sharing, you need do the below DataBase stuffs.

1. Create new table for Albums
tbl_albums

Colums may be -
> albumID - ID of Album
> albumName - Name of Album
> createdBy - ID of User who is creating
> createdOn - DateTime of Album Creation
> updatedBy - ID of User who is updating the album
> updatedOn - DateTime when Album got Updated
> isDeleted - extra column for checking the existence of row. Default is 0 always.

2. Create new table for Images in Albums
tbl_albumImages

Colums may be -
> ID - Primary key of this table.
> albumID - ID of Album
> imageID - ID of Image

3. Create new table for Sharing of Albums
tbl_sharedAlbums

Columns may be -
> ID - Primary key of this table.
> albumID - ID of album from table tbl_albums
> sharedBy - UserID of user who is sharing.
> sharedTo - UserID of friends you want to share. You can use this column for custom sharing or can remove this column if not needed. I mean if you want the album to be shown to all then don't use it, if you have some options for custom sharing, then you have to store the UserIDs to which you want to share.
> sharedDate - Date and Time when the album is shared.
> modifiedBy - UserID of user who modified.
> modifiedDate - If any modification is done to the shared album.
> isDeleted - extra column for checking the existence of row. Default is 0 always.

In coding you have to do like below.

1. While the creation of Album, insert rows in tables tbl_albums and tbl_albumImages.
2. On clicking of share album button, you have to insert row to the table tbl_sharedAlbums.
3. While showing the albums of user, you just need to go through this table and match sharedBy column with the current UserID.
If exists then go for step-4.
4. Fetch the records in step-3 and from the albumID column, you can then get the album details from table tbl_albums.
5. After getting the album details, then you have to check if any records (pictures) exists in table tbl_albumImages.
If exists, then go for step-6.
6. Get all imageID for the album and fetch the image details from your table tbl_images and show in the Profile.

[/update]

Thanks...
 
Share this answer
 
v2
Comments
suma2212 19-Dec-12 3:49am    
Hi Tadit,

thank you for your answer. i want query and asp.net code for this functionality. please provide me. i tried it but i did not get the correct solution.
please help me....
suma2212 19-Dec-12 3:54am    
Hi Tadit,

For this i am using Datalist. in that datalist i add image button. in that down of the image button i insert Link button (share). when i click that share link button it will display all my friends list.

please help me
Hi @suma2212,

It sounds nice that you are trying to complete the task.

I have given the idea. You need to implement.

As you said that you have one DataList and on clicking of share linkbutton, you are displaying the friends list. I guess it is working.

But what you want to do with this friends list?

You needed the concept how to implement the share image, correct?
Have you tried what I explained to you?

Please reply.

Thanks,
Tadit
suma2212 20-Dec-12 2:25am    
Hi thanq for ur reply. My TL changed this requirement. first we have to create an album,in down of that album insert share button. when i click share button that album will shared to all his friends.

please give me any idea, and please give any example.
Check my updated answer.
Thanks...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900