Click here to Skip to main content
14,691,183 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Please help, so i created a login form a registration and a dashboard, first, their are two database tables, the Users_Table and the Dashboard_Table

The users_table contains the:
user_id
userName

The dashboard_table contains the:
user_id
item_name
item_quantity


what i plan to do is that whenever a user logs in he is then brought to the dash board windows form,(there are 3 forms, login, registration and dashboard) then when he is at the dashboard form there is a data grid view where the data from the dashboard_table is listed but the problem is how do i connect the primary key user_id in the users_table and foreign key user_id in the dashboard_table so that whenever a user logs in, he has that unique user_id that is tied to the username he entered, and that the data that will be displayed in the data grid view in the dashboard form are those that are only associated with his user_id, like for example, :

James logged in, his user_id is 1, only data that are associated with the user_id 1 are displayed in the data grid view, like

(user_id, item_name, item quantity)

1 Pop Tarts 5
1 Tomato Sauce 2
1 Mozzarella cheese 3





but what happens is, there is no data inside the data gridview, i want it to be at least empty and there is an add button and delete button and edit button with their own text boxes

Another problem, i opened ssms and looked at the database tables,
when James registered through the registration form, his username only created a record in the users_table and the dashboard_table was still empty. Take note, the user_id is in auto increment.

How will i make it that whenever a new user registers, and his/her data is stored in the users_table, a empty record is also created in the dashboard_table, how can i do this using foreign and primary keys in ssms then manipulate it in visual studio windows forms?

What I have tried:

I currently have the login and registration and the dashboard forms done and the two database tables, but i dont know how to link and use foreign and primary keys, since im really new to Sql,
Posted
Updated 4 days ago

1 solution

You need to "simplify" your explanation.

A user gets a login screen. Period.

If they don't get past the login screen, they see "nothing".

User id / email and password. That's it.

Your task at this point is simply to verify that the user id / email and password match.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900