Passing Memberid into another table

Discussion in 'ASP.NET 2.0' started by Chris cee, Jan 16, 2007.

  1. What I want to do is pass the memberid fromMembership.GetUser().ProviderUserKey.ToString to memberid in another table. does anyone know how this is done?
     
  2. Can you plase elaborate or rephraseyour question? it doesn't make sense to me.





    Joel Thoms
    DiscountASP.NET
    http://www.DiscountASP.NET
     
  3. I have 2 tables


    One is the Membership table holding the memberid.


    One that Holds deatails of an News Item


    If a user adds a News Item I want to log the memberid in the news table, as lets say News_added_by


    So that I can then only show an Edit button on that news itemto the user that initially made the news item entry.


    I have a feeling this can be done using Foreign kEYS but I don't know how that works


    Hope that makes sense
     
  4. Unless I have misunderstood your question, I believe all you have to do is perform an INSERT into the database with something like...


    INSERT INTO table2 (News_added_by, news) VALUES (@memberid, @news)


    Joel Thoms
    DiscountASP.NET
    http://www.DiscountASP.NET
     
  5. mjp

    mjp

    A foreign key is just a field that exists as a primary key in another table. Giving them the same name is useful for making your database design understandable, but you can name the member id field in table 2 anything you'd like and it's still workable.


    Generally speaking though, your life will be a lot easier if the same data has the same name across different tables.


    mjp
    DiscountASP.NET
    <SUB><SUP>http://DiscountASP.NET
     

Share This Page