|
-
Dec 19th, 2005, 02:59 AM
#1
Thread Starter
Hyperactive Member
Automatically writing to SQLdatabase from a text file
Hi!,
Can anybody tell me how to solve this problem. I want to do this using a dll (I want to make it.). When the text file is updating(i.e. editing), database should be updated. There may be several fields related to a table of that database. Delimiter is a comma. when we press Enter key or moving to a new line the record (line) should be saved to the database. Pls. help me in this problem.
-
Dec 19th, 2005, 09:19 AM
#2
Re: Automatically writing to SQLdatabase from a text file
What are you using for a front end?
-
Dec 21st, 2005, 03:32 AM
#3
Thread Starter
Hyperactive Member
Re: Automatically writing to SQLdatabase from a text file
 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
-
Dec 21st, 2005, 08:09 AM
#4
Re: Automatically writing to SQLdatabase from a text file
No, I meant are you using VB6 or VB.NET or C# or what?
-
Dec 27th, 2005, 02:37 AM
#5
Thread Starter
Hyperactive Member
Re: Automatically writing to SQLdatabase from a text file
 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.
-
Dec 27th, 2005, 11:45 PM
#6
Lively Member
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
-
Dec 28th, 2005, 05:51 PM
#7
Re: Automatically writing to SQLdatabase from a text file
 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:
Private Const FILE_NOTIFY_CHANGE_ATTRIBUTES = &H4
Private Const FILE_NOTIFY_CHANGE_DIR_NAME = &H2
Private Const FILE_NOTIFY_CHANGE_FILE_NAME = &H1
Private Const FILE_NOTIFY_CHANGE_SIZE = &H8
Private Const FILE_NOTIFY_CHANGE_LAST_WRITE = &H10
Private Const FILE_NOTIFY_CHANGE_SECURITY = &H100
Private Const FILE_NOTIFY_CHANGE_ALL = &H4 Or &H2 Or &H1 Or &H8 Or &H10 Or &H100
Private Declare Function FindFirstChangeNotification Lib "kernel32" Alias "FindFirstChangeNotificationA" (ByVal lpPathName As String, ByVal bWatchSubtree As Long, ByVal dwNotifyFilter As Long) As Long
Private Declare Function FindCloseChangeNotification Lib "kernel32" (ByVal hChangeHandle As Long) As Long
Private Declare Function FindNextChangeNotification Lib "kernel32" (ByVal hChangeHandle As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function ResetEvent Lib "kernel32" (ByVal hEvent As Long) As Long
Private Sub Form_Load()
'KPD-Team 2000
'URL: [url]http://www.allapi.net/[/url]
Dim Ret As Long
'Set the notification hook
Ret = FindFirstChangeNotification("C:\", &HFFFFFFFF, FILE_NOTIFY_CHANGE_ALL)
'Wait until the event is triggered
WaitForSingleObject Ret, &HFFFFFFFF
MsgBox "Event Triggered for the first time"
'Reactivate our hook
FindNextChangeNotification Ret
'Wait until the event is triggered
WaitForSingleObject Ret, &HFFFFFFFF
MsgBox "Event Triggered for the second time"
'Remove our hook
FindCloseChangeNotification Ret
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|