开发者

message board / scrapbook in asp.net

I am asp.net developer

I need to know about how does scrapbook works in orkut?

I need to make an application in which the user can reply to each other

Upto the limit of 10开发者_StackOverflow00 characters


Its a very broad question so my answer is going to have to be quite broad in scope,

First things first we're gonna need a database to contain the data, I don't know what else is going into your site so lets go with a basic 2 table model. You'll probably want to add more fields depending on your requirements.

Tables  users         ScrapbookPost
Fields  UserID (pk)   SBPID    (pk)
        UserName      ToUser   (fk)
        Password      FromUser (fk)
                      PostText
                      CreateDate

With that basic structure we can have users leaving each other Scrapbook posts

This SQL code would retrieve all posts on a users wall where @userPage is the userID of the current users page.

Select 
    u.UserName, PostText, CreateDate
From 
    users u inner join
    scrapbookpost sb on u.UserID = sb.FromUser
where
    sb.ToUser = @userPage
order by
    CreateDate desc

Seeing a conversation between two users would mean querying like this

Select
    u.UserName, PostText, CreateDate
From
    users u inner join
    scrapbookpost sb on u.UserID = sb.FromUser
where
    (ToUser = @userID1
    and
    FromUser = @userID2)
    or
    (ToUser = @userID2
    and
    FromUser = @userID1)
order by
    CreateDate desc

That's the basic data structure and queries you need! Give the users a webform to write posts and validate on the server side to make sure the posts are less than 1000 characters and don't contain any nasties like cross site scripting or sql injection

For their scrapbook pages use either Stored procedures or construct your query manually then bind your results to an ASP Repeater for output.

To beautify things a bit you could consider allowing them some HTML formatting with a control like this or rich text editing with a control like this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜