Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
See more:
I am using a form application and a web application using .net(SQL server database) and i want to share the database between form application and web application. i.e. changes made in the database from any one application should be reflected in other. What are my options to implement the same?

I have a little idea about Web service(just the concept). Also let me know if the same can be used for this purpose(database sharing)and if so, how? Any other solution is otherwise welcomed. Thanks. :)
Posted
Updated 24-Feb-14 23:10pm
v2
Comments
Charan_Kumar 25-Feb-14 4:07am    
1) you have write two connections string in web.config. (or)
2 you may use triggers

 
Share this answer
 
v3
Comments
Dean_Wi 25-Feb-14 5:05am    
you just mentioned about using triggers for after events in the database. but i don't get how that would help to retrieve the changes made in the database from another application! :/
Joezer BH 25-Feb-14 5:28am    
What do you mean by retreive the changes?
If you want you can view the log files changes made on a DB, but I doubt you would want to do that...

If you want to pass specific data between the processes, you can implement a messaging technique between the two application (possible via a the DB itself) or some other IPC method which would be more efficient than using triggers.


I'm not sure what you mean "i want to share the database between form application (..) changes made in the database from any one application should be reflected in other"...

Have a look at SQLDependecy class[^].
Here is an sample implementation: Using SqlDependency for data change events[^]

For further information, please see:
Detecting Changes with SqlDependency[^]
Using SqlDependency in a Windows Application[^]
SqlDependency in an ASP.NET Application[^]

[EDIT]

If you don't know how to set up instance of SQL Server to listen network connections, please read this:
Configure a Server to Listen on a Specific TCP Port (SQL Server Configuration Manager)[^]
Configure a Server to Listen on an Alternate Pipe (SQL Server Configuration Manager)[^]
Note: sometimes it's necessary to configure firewall
Configure the Windows Firewall to Allow SQL Server Access[^]

[/EDIT]
 
Share this answer
 
v2
Comments
Dean_Wi 25-Feb-14 5:11am    
I just want to share database between web app and form app ..
Tell me how..???
Maciej Los 25-Feb-14 5:24am    
What is exact question?
See my answer after update!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900