C# Sql back and forth data transfer
So I am trying to make let's say, a chat software. For this example there will be two users X and Y and the Database named DB:
1. Both X and Y are connected to DB
2. X sends a message through a form by clicking submit,
3. the message is then recorded into DB
4.
id|from|to|message
17|X |Y |Hello!
5. DB instantly sends sql result
6. Y sees "Hello!" on his screen.
The only, but the most important part is #5. How to do that?
kolibrizas
Junior Poster in Training
52 posts since May 2009
Reputation Points: 22
Solved Threads: 2
Triggers is how you would do this. If you are using SQL Server it is possible to write modules in C# that can be executed by the server. It would be easier just to have the client poll the DB for info.
I do have to ask, though, why save the message in the DB? Have you considered a 3-tier solution (Server, Client, DB)?
Momerath
Nearly a Senior Poster
3,386 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558
Triggers is how you would do this. If you are using SQL Server it is possible to write modules in C# that can be executed by the server.
I am starting to google this in a second.It would be easier just to have the client poll the DB for info.You mean like client to send query for new info every 1 second or so? If yes, then it doesn't really suit me.I do have to ask, though, why save the message in the DB? Have you considered a 3-tier solution (Server, Client, DB)? Can you please provide me with a simple drawn/written scheme on how this would work?
kolibrizas
Junior Poster in Training
52 posts since May 2009
Reputation Points: 22
Solved Threads: 2
use trigger in database and WCF in front end that will really help you
---try code your self---
-----you learn more-----
mani-hellboy
Junior Poster in Training
69 posts since Feb 2012
Reputation Points: 0
Solved Threads: 7
"5. DB instantly sends sql result"
It obviously states that AJAX is not capable to solve that. But thanks for trying to help. Maybe any more ideas? And I do not care whether for web or windows based :) Both will be fine.
Edit: Thanks for a link. I had already reviewed it tho.
kolibrizas
Junior Poster in Training
52 posts since May 2009
Reputation Points: 22
Solved Threads: 2