I have a program in Visual Studio that loads table data from SSMS. Right now, it's hard coded in to load specific tables no matter who logs in.
In SSMS, I have tables of college classes. When a user logs in, I want to run code in Visual Studio to insert the classes they've taken (located in SSMS) into tables in Visual Studio.
The root of my question is: How and in which program do I basically code "user with (current ID) has logged in. Get their data from SSMS and put it in the tables.
You don't have to answer the latter part necessarily but I'm really struggling with getting first part. Getting the persons ID who's logged in.Is it SCOPE_IDENTITY? Is it @@IDENTITY? Trying my best to understand this microsoft doc on scope identity.
Info (loads at top of program): https://i.imgur.com/EFBvBgU.pngc#sqlvisual-studiosql-server-2008ssms
This has nothing to do with identity. Identity describes auto-incrementing columns on a table.
The easiest way to accomplish this would be with a parameterized stored procedure. When your user logs in, you execute a procedure that will return all the class info for that user ID. If they are each going to be a user/login in SQL Server, you can use
to get their id, but chances are that will not align with what is in your table data.