Harini
Harini

Reputation: 21

How to create table in database automatically using C#

Whenever the new user logs in to his registered account, at that time I need to create a table automatically for his account & it has to access the user name as the table name using C# coding. Because I want to add product details into cart like online shopping sites. If user login into their account what are the details available in the cart should display in their page.. is there is any other way to add product details into cart....

Upvotes: 0

Views: 754

Answers (2)

Phạm Văn Huy
Phạm Văn Huy

Reputation: 19

Online shopping cart is the temporary data in the current user session, I think you don't need to create table to stored that data. You just create a session variable (DataTable) to stores data of online shopping cart.

Upvotes: 0

Henning Koehler
Henning Koehler

Reputation: 2657

You shouldn't create a new table for each user. Instead create a single user table where you store user-specific data (such as username, email, etc.). Then for any type of item that you want to associate with a user, such as purchase items, create a foreign key to the user table. You may want to read up on the basics of relational/SQL database design first.

Upvotes: 3

Related Questions