Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Dec 2005
    Posts
    25
    Thanks
    1
    Thanked 0 Times in 0 Posts

    adding a poll to a blog

    Hi all,

    I have a blog table...

    Code:
     
    myBlog(Table)
    BlogID (primary key)
    Text(varchar 8000)
    Date(datetime)
    that has another associated table...

    Code:
     
    myBlogRatings(Table2) 
    RatingID (primary key) 
    Rating (float) 
    RatersIP (varchar 15) 
    BlogID (foreign key)
    but now I want to be able to attach a poll to blog if needed...

    Code:
     
    myBlogPoll(Table3)
    PollID (primary key)
    PollQuestion (varchar 3000)
    PollVote (int)
    PollIpAddress (char 15)
    Here's my question... I want to be able to add the poll at the same time as the blog. How do I do that? This means that if a certain checkbox is checked then all the poll at the same as the blog... if it is not then the only add the blog.

    This is different from a rating because there is already a BlogID to reference. How do I add the blog's BlogID to the myBlogPoll as a foreign key. I am having a hard problem with this is because the BlogID is added to myBlog(Table1) as an identity (set to increment by 1).

    So far I have found out that I can only edit one table at a time using TSQL. Is there a workaround that someone knows of? Javascript, ASP.net, anything.

    Thanks in advance,

    PS... I am trying to do the same thing as this forum is doing while taking in threads.

    -a8le
    Noteful.COM, read and share anonymous online secrets and confessions.

  • #2
    New Coder
    Join Date
    Dec 2005
    Posts
    25
    Thanks
    1
    Thanked 0 Times in 0 Posts
    anyone?
    Noteful.COM, read and share anonymous online secrets and confessions.

  • #3
    New Coder
    Join Date
    Mar 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have a similar system with my site, when a news post is created, it also creates a forum post and takes the postid from the forum and inserts it into a field called forumID in the news table. I think this is what your trying to do with your blog/poll thing?

    I did it by firstly inserting the forum post and then taking the maximum id from the forum table and inserting it into the news table along with the news post.

    Not sure if this is what you mean.

  • #4
    New Coder
    Join Date
    Dec 2005
    Posts
    25
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by NuneatonSam
    maximum id
    hmm... i didn't think about doing it that way. it is exactly what i mean.

    can you provide me with some sample code? by the way i am using a stored procedure... can it still be accomplished?

    -a8le
    Noteful.COM, read and share anonymous online secrets and confessions.

  • #5
    New Coder
    Join Date
    Dec 2005
    Posts
    25
    Thanks
    1
    Thanked 0 Times in 0 Posts
    NuneatonSam, thanx for the reply, I ended up editing the main table to include the polls.
    Noteful.COM, read and share anonymous online secrets and confessions.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •