CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   ASP.NET (http://www.codingforums.com/forumdisplay.php?f=40)
-   -   Storing Logged in Username in table of asp.net (http://www.codingforums.com/showthread.php?t=270714)

rashid 08-17-2012 12:32 PM

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.

alykins 08-17-2012 07:59 PM

assuming OrderId is an identity field...

Code:

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

5 is a random "UserId"

Narasimha Rao K 08-22-2012 09:53 AM

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)).

vnit969 09-12-2012 06: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)


All times are GMT +1. The time now is 04:40 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.