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....
-
Are you sure you want to create a new table for each user?Vidhyardhi Gorrepati– Vidhyardhi Gorrepati2016-11-29 02:51:01 +00:00Commented Nov 29, 2016 at 2:51
-
yaa sure....i want to create separate table....please help me how to createHarini– Harini2016-11-29 03:02:28 +00:00Commented Nov 29, 2016 at 3:02
-
well...in that case, create a SP which creates a table and call that SP from your code.Vidhyardhi Gorrepati– Vidhyardhi Gorrepati2016-11-29 03:07:02 +00:00Commented Nov 29, 2016 at 3:07
-
but in that case, we cant pass user name as table nameHarini– Harini2016-11-29 03:12:41 +00:00Commented Nov 29, 2016 at 3:12
-
stackoverflow.com/questions/1246760/…Vidhyardhi Gorrepati– Vidhyardhi Gorrepati2016-11-29 03:25:09 +00:00Commented Nov 29, 2016 at 3:25
Add a comment
|
2 Answers
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.
2 Comments
Henning Koehler
You can just run a
CREATE TABLE query.Bryan Dellinger
when you say create table automatically are you talking about code first entity framework? entityframeworktutorial.net/code-first/…