1
Hello, I have the following question.
I’m running a c# application with SQL Server database.
I have a Datagridview where he is carried via Datatable, the information loaded is from people: Name, Status ...
I want you to update the status (change from offline to online) Update the Datagridview automatically.
Currently I do this with a team, which is every 15 seconds updating the form, but I find it unfeasible, and if I need to update the form every 1 second?
and if it’s 100,000 people?
How can I do this via Trigger Update:
Select * from pessoa
, c# application captures this select and inserts it into Datagridview.
EX: I got to it:
>CREATE TABLE PESSOA(
NOME VARCHAR(250)
)
CREATE TRIGGER SELECIONAR_NOME ON DBO.PESSOA
AFTER UPDATE AS
BEGIN
SELECT * FROM PESSOA
END
Entering Values in the Table
INSERT INTO PESSOA(NOME) VALUES ('fulano1')
INSERT INTO PESSOA(NOME) VALUES ('fulano2')
INSERT INTO PESSOA(NOME) VALUES ('fulano3')
INSERT INTO PESSOA(NOME) VALUES ('fulano4')
INSERT INTO PESSOA(NOME) VALUES ('fulano5')
UPDATE PESSOA SET NOME = 'fulano0' WHERE NOME = 'fulano1'
How do I get this table? The table that came out of Trigger After Update?
Present the code and point exactly where your question is. Ps.: NEVER do
SELECT * FROM
– Leandro Angelo
Man, it’s not a question, I ask if you have a better way to do what I mentioned as I do, I do not need to post code because there is to understand perfectly. Has a Clock that every 15 seconds is giving select in the table just that...
– Gustavo Pedro
I understood... but this way the question is out of scope for not presenting a [MCVE]
– Leandro Angelo
Man what you said is a problem, I’m not with a difficultness in the code, it’s not a bug that I don’t know how to solve, I’m asking the best way, how will I post a better way to see the problem(minimum) if it doesn’t exist? All information is included. It is verifiable when I test and make sure that this way works and become more intuitive and not just something updating every certain time
– Gustavo Pedro
http://prntscr.com/n380i6
– Gustavo Pedro
Dude, there are N practices and approaches to working with this kind of problem so the question becomes too broad. I think you should consider a
SELECT * FROM Pessoa
eachx
seconds, as a point of revision of your code, given that you are already concerned with scale and performance– Leandro Angelo
What I posted was just an example, I put the "code" that I did now, to see if it better exemplifies my doubt
– Gustavo Pedro