Click here to Skip to main content
Click here to Skip to main content

TwinXBase service

By , 11 Sep 2002
Rate this:
Please Sign up or sign in to vote.
<!-- Download Links -->

How it works:

This service scans in a directory (C:\FILESERVICE\INBOX) by using the .NET  FileWatcher component  (not really scans - it just checks for created files)

when a file is created the service will check the extension of the file. If the file has the extension .DBX then it will read the contents of the file and communicate with the database (C:\FILESERVICE\DB\MyDB.mdb) and insert / update / delete the records in the database. Then the file will be moved to the subdirectory \BACKUP. When an error occurs the error will be logged in the EventLog.

If an other file other than a DBX arrives in the inbox it will be moved  to the subdir \UNKNOWN.

If you look at the code, you can easy make the service to use with other kind of files. and you can make an application (class) that handle those files.

Example extension

Mail could be used to send mails by using my code in "C# mail console" so when you share the C:\FILESERVICE\Inbox for FTP , the service will handle the incoming files...

First run

If the service is running then the first time it will check if the directory's exists on the C:\ drive. if not, it will be created. The directory's are:

  • C:\FILESERVICE\DB
  • C:\FILESERVICE\INBOX
  • C:\FILESERVICE\INBOX\BACKUP
  • C:\FILESERVICE\INBOX\UNKNOWN

In the zip file you can find 2 examples for database use, called USERS.DBX and ARTICLES.DBX If you want to view those files open it with notepad. the records are comma separated.

Next you have to do is copy the Access dababase file included in the zip file and copy it to the C:\FILESERVICE\DB directory.

Then you can put a example of the file .DBX in the inbox dir, and the service will handle the file. Open then the database file and check the records that are inserted/updated / deleted.

Installing the service

First compile the application so you will have an executable (exe). For the Visual Studio users, go to Start -> Microsoft VS.NET -> VS.NET Tools -> VS.NET Command Prompt. You will see a command box (console) then go to the directory where the exe is. then in that directory type

InstallUtil MyFileService.exe 

This will install the service Once it correctly installed you can start the service by typing

NET START TWINXBASE 

Or you can go to Services in Configuration, look for the new service, start it. To Remove the service, stop the service and type

InstallUtil /u MyFileService.exe

Remark

This is just a small example.. I will try to make the service later for reading XML files for database use and others. But now you have an idea howto create a service and more..

Enjoy.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Petervu
Web Developer
Belgium Belgium
Education :
- Graduate Electronics
- Graduate Informatics
 
Skills:
- VB6
- Delphi
- C/C++
- C# (basics)
 
Work:
- Application Developper in Retail Firme,
developping Point Of Sale Apps.
(Front and Backstore)
 

Comments and Discussions

 
QuestionWhat's the meaning? PinsitebuilderUwe Keim16-Sep-02 19:59 
AnswerRe: What's the meaning? PinmemberJoe Billy26-Jul-03 3:22 
AnswerRe: What's the meaning? Pinmembermstallmann10-Sep-03 5:10 
QuestionRe: What's the meaning? Pinmemberwinni7825-Jan-06 9:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 12 Sep 2002
Article Copyright 2002 by Petervu
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid