Go Back   CodingForums.com > :: Server side development > ASP.NET

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-17-2012, 12:32 PM   PM User | #1
rashid
New to the CF scene

 
Join Date: Aug 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
rashid is an unknown quantity at this point
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.
rashid is offline   Reply With Quote
Old 08-17-2012, 07:59 PM   PM User | #2
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
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
alykins is offline   Reply With Quote
Old 08-22-2012, 09:53 AM   PM User | #3
Narasimha Rao K
New Coder

 
Join Date: Feb 2011
Location: India
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Narasimha Rao K is an unknown quantity at this point
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)).
Narasimha Rao K is offline   Reply With Quote
Old 09-12-2012, 06:03 PM   PM User | #4
vnit969
New to the CF scene

 
Join Date: Sep 2012
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
vnit969 is an unknown quantity at this point
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)
vnit969 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:18 PM.


Advertisement
Log in to turn off these ads.