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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Storing Logged in Username in table of asp.net

    Hi,

    I'm developing a Customer online ordering system using asp.net.

    I created two tables Users & Orders.
    1. User table consists of the columns (UserId, Username, Password etc.)

    2. Order Table COnsists of the columns (OrderId, Order name,UserId)

    I link two tables the User Table and order Table by specifying UserId in the User table as Primary key and foreign key as UserId in Order table.

    Once a normal User looged in to the system, he should be able to create his orders.

    Once he create order, his logged in Username should be stored in the Order table for reporting purpose.

    How can i make this?

    Please guide me on this.

  • #2
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,776
    Thanks
    41
    Thanked 196 Times in 195 Posts
    assuming OrderId is an identity field...

    Code:
    insert into tblOrder ([OrderName], [UserId], etc...)
    values ('someName', 5, etc)
    5 is a random "UserId"

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #3
    New Coder
    Join Date
    Feb 2011
    Location
    India
    Posts
    20
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Smile User Name entry

    Mr
    Rashid
    when, first time user logged into the page,after enter his credentials,in submit button click event capture the user Id, then send it to the table, get the name of the user then insert into order tble .
    insert into tblOrder ([OrderName], [UserId],[username])
    values ('someName', 001,(User Name)).

  • #4
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Code:

    string UserId = System.Guid.NewGuid().ToString();
    string OrderId= System.Guid.NewGuid().ToString();

    insert into TableUser((UserId, Username, Password etc.)
    insert into TableOrder(OrderId, Order name,UserId)


  •  

    Posting Permissions

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