r/visualbasic • • Dec 06 '20

VB.NET Help A simple application in vb.net and mysql

Can please someone help me make the structure of the database in mysql.. there are 2 forms a login form and the mainform, every user who log in have their own unique table on the form where he can add/edit delete data that other users cant see. The question is how i should make the databse in a proper way.. every user should get a new database ? Or 1 database and multiple tables ... how i should proceed ?

5 Upvotes

3 comments sorted by

3

u/Mortiouss Database Specialist Dec 06 '20

Multiple tables would be a maintenance nightmare, set each individual to a unique Id (user table), I use guid for that, make your data table with a foreign key that matches the user I’d, and simply prevent others from seeing data that isn’t their ID.

Btw not really sure how this is a vb.net question unless you want the code to do that, which I will do but not for free.

2

u/Hounish Dec 06 '20

A simple way would be to have one table for the user accounts and one table for the "records".

The records table should have the user ID as a foreign key

This way, in the records table, users will be able to add/edit/delete only their own records.

1

u/chacham2 Dec 07 '20

every user who log in have their own unique table on the form where he can add/edit delete data that other users cant see.

They each have a table, or a row?