Wednesday, March 7, 2012

automate passing

hi!

i already have a program that when you click a button it will get the new transactions in the database then pass it to another database now i need to automate the passing... once there is a new entry in the database it should automatically pass it to the other database. how could i do this?!

thanks!

I believe there is a way to do such mirroring if the databases are both SQL Server databases and if that is the case you should post the same question to the appropriate SQL form...

Otherwise one could write a service application, an application with no GUI which runs as a windows service i.e not as a user, but the system, to check for the transfer condition, then do the read from the first database then write out to the second database. Here are a couple of links to get you started.
Windows Service Application|||

my other database is Oracle. But thanks for the links you gave! it was very helpful! ^_^

i now know how to create the windows service but how can i modify my previous program... originally the button has to be clicked for the transaction to be passed.. it also has an interface (a form with 2 buttons). Any tips or suggestions as to how i would change it?

thanks again!

|||You need to isolate the business logic away from the GUI logic. Its a common problem for people writing quick code...it all gets placed into one layer.

What you need to do is create a new assembly (library assembly) which will hold just the logic of contacting the database and returning or processing into it the data. Once that code is in a separate assembly, have the GUI application reference that assembly then remove the current db access code. Then wire in the GUI to use the new database/biz logic code from the newly created assembly.

Once you have it broken out you can now work on creating a windows service which will do the work in the background so to speak.

As a developer, get into the habit of always separating the code into layers. You may have heard of a three tiered architecture and this is what you are striving for... The first layer is a GUI or service or unit test layer which contacts a business layer which in turn contacts the database layer. Each of those layers are in separate assemblies which lend themselves to being unit tested outside the application via either NUnit tests or console applications linking in... Good luck.|||thanks for the explanation! ^__^

No comments:

Post a Comment