1.11M Members

C# Sql back and forth data transfer

 
0
 

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?

 
1
 

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)?

 
0
 

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?

 
-1
 

use trigger in database and WCF in front end that will really help you


---try code your self---
-----you learn more-----

 
0
 

If both X and Y are polling the database at frequent intervals like say every 5 second, then you would not need to write triggers. AJAX could get the data to either from DB.
You may refer to this artiele as a starting point.
On a side note, you have not indicated if this is web based or a windows based application. Both can be in C# .....

 
0
 

"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.

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: