I have a table in sql server datbase and gridview retrieves the result of that table. That table at first all the values are 0
but when a user log-in he can edit gridview so table will be updated . But if there is two different users , how they can make and see their own updated data in gridview ? . Here is the table looks like . I am just asking for logic , i just added one more column called Userid
.
Any help appreciate ?
Thanks
If all the users has to edit the same data, i mean all users can see the data in the table, not just where userid = tableuserid, then u can use the application("") aspnet object to save when a user had updated the datatable and a webservice to the tell the others user that other user updated the table.
U can use something like versioning in the application("") object. when the users login and loads the data, then he save the current number in the applicationb object. Then you can create a javascript call to a web service to check if the number stills the same. if not reloads the page with the new
If the data is related to each user, you can take any of the others two answers... good luck
reply if you need help
I think your'e on the right track. Ultimately this data needs to have a UserId
associated with it. When querying the data to populate your GridView
you should filter where the UserId == currentUserId
EDIT : the specifics of the necessary database design for this will vary depending on the type of data, and how it might need to be broken up into more than one relational table.
Different user(s) will see their specific data in order to provide privacy (encapsulation). So, when a user logged in, on your application load you should query the table like below and fill the data to grid
select ID,Act1,Act2,[User Id]
from user_table
where [User Id] = logged_in_userid;
that way each user will update only their own data which eventually will get saved in DB. You may want to wrap the query in a stored procedure like below and in your page load call the procedure with parameter.
create procedure usp_get_userData @userid int
as
begin
select ID,Act1,Act2,[User Id]
from user_table
where [User Id] = @userid;
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.