Results 1 to 7 of 7

Thread: Automatically writing to SQLdatabase from a text file

Hybrid View

  1. #1

    Thread Starter
    Hyperactive Member Chathura's Avatar
    Join Date
    Nov 2005
    Location
    Sri Lanka
    Posts
    345

    Re: Automatically writing to SQLdatabase from a text file

    Quote Originally Posted by Hack
    What are you using for a front end?


    We have a time attendance card reader which, outputs EmpCode, time, etc. to a text file. We want to write a DLL to send those information to a SQLServer database automatically after one input is made to that text file. I don't know whether I want to use an API or I can manage it with simple vb commands. pls! help



    Chathura

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Automatically writing to SQLdatabase from a text file

    No, I meant are you using VB6 or VB.NET or C# or what?

  3. #3

    Thread Starter
    Hyperactive Member Chathura's Avatar
    Join Date
    Nov 2005
    Location
    Sri Lanka
    Posts
    345

    Re: Automatically writing to SQLdatabase from a text file

    Quote Originally Posted by Hack
    No, I meant are you using VB6 or VB.NET or C# or what?
    Sorry, I was not be able to understand what you were asked for . I hope to use VB6 but still I did not start coding because I don't know how to track the incoming people.
    Last edited by Chathura; Dec 27th, 2005 at 03:23 AM.

  4. #4
    Lively Member
    Join Date
    May 2005
    Posts
    74

    Re: Automatically writing to SQLdatabase from a text file

    You can use WaitForSingleObject API to get change notifiation of a file. You use this API for your text file and receive events in any front end tool. According to change you receive you can write code/login for your program.
    You need to search more about this API. You can easily get ready made code from the Internet for this.

    Thanks
    Sanjivani

  5. #5
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: Automatically writing to SQLdatabase from a text file

    Quote Originally Posted by sanjivani
    You can use WaitForSingleObject API to get change notifiation of a file. You use this API for your text file and receive events in any front end tool. According to change you receive you can write code/login for your program.
    You need to search more about this API. You can easily get ready made code from the Internet for this.

    Thanks
    Sanjivani
    VB Code:
    1. Private Const FILE_NOTIFY_CHANGE_ATTRIBUTES = &H4
    2. Private Const FILE_NOTIFY_CHANGE_DIR_NAME = &H2
    3. Private Const FILE_NOTIFY_CHANGE_FILE_NAME = &H1
    4. Private Const FILE_NOTIFY_CHANGE_SIZE = &H8
    5. Private Const FILE_NOTIFY_CHANGE_LAST_WRITE = &H10
    6. Private Const FILE_NOTIFY_CHANGE_SECURITY = &H100
    7. Private Const FILE_NOTIFY_CHANGE_ALL = &H4 Or &H2 Or &H1 Or &H8 Or &H10 Or &H100
    8. Private Declare Function FindFirstChangeNotification Lib "kernel32" Alias "FindFirstChangeNotificationA" (ByVal lpPathName As String, ByVal bWatchSubtree As Long, ByVal dwNotifyFilter As Long) As Long
    9. Private Declare Function FindCloseChangeNotification Lib "kernel32" (ByVal hChangeHandle As Long) As Long
    10. Private Declare Function FindNextChangeNotification Lib "kernel32" (ByVal hChangeHandle As Long) As Long
    11. Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
    12. Private Declare Function ResetEvent Lib "kernel32" (ByVal hEvent As Long) As Long
    13. Private Sub Form_Load()
    14.     'KPD-Team 2000
    15.     'URL: [url]http://www.allapi.net/[/url]
    16.     'E-Mail: [email][email protected][/email]
    17.     Dim Ret As Long
    18.     'Set the notification hook
    19.     Ret = FindFirstChangeNotification("C:\", &HFFFFFFFF, FILE_NOTIFY_CHANGE_ALL)
    20.     'Wait until the event is triggered
    21.     WaitForSingleObject Ret, &HFFFFFFFF
    22.     MsgBox "Event Triggered for the first time"
    23.     'Reactivate our hook
    24.     FindNextChangeNotification Ret
    25.     'Wait until the event is triggered
    26.     WaitForSingleObject Ret, &HFFFFFFFF
    27.     MsgBox "Event Triggered for the second time"
    28.     'Remove our hook
    29.     FindCloseChangeNotification Ret
    30. End Sub


    Has someone helped you? Then you can Rate their helpful post.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width