...

View Full Version : Storing Logged in Username in table of asp.net



rashid
08-17-2012, 01:32 PM
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.

alykins
08-17-2012, 08:59 PM
assuming OrderId is an identity field...



insert into tblOrder ([OrderName], [UserId], etc...)
values ('someName', 5, etc)



5 is a random "UserId"

Narasimha Rao K
08-22-2012, 10:53 AM
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)).

vnit969
09-12-2012, 07:03 PM
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)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum