|
You actually have no way of knowing that a copy operation is taking place.
A copy operation is nothing but a process opening a file for read and opening another file for write. The process then just reads a block of bytes from one file and writes that block of bytes to the other.
The Last Modified date is updated by the file system on the file being written. Once the operation is finished, the files are closed and the file system updates the Last Modified date on the file written.
That's it, there's nothing special about a file copy. It's no different from an app just writing whatever it needs to to a file on the same disk, say when Notepad saves a file. You can't tell the difference.
All you can tell is that a file was written to the disk. You have no way of knowing why that file was written.
|
|
|
|
|
Do not know if this is applicable but I found this in a search on the internet.
It sounds rather dangerous but perhaps it will help. Search on
Microsoft docs "File System Filter Drivers" which looks like a kernel level driver that may provide
what you want.
From the documentation:
A file system filter driver is an optional driver that adds value to or modifies the behavior of a file system. A file system filter driver is a kernel-mode component that runs as part of the Windows executive.
A file system filter driver can filter I/O operations for one or more file systems or file system volumes. Depending on the nature of the driver, filter can mean log, observe, modify, or even prevent. Typical applications for file system filter drivers include antivirus utilities, encryption programs, and hierarchical storage management systems
Information I found indicates this is not easy to implement. Again, unless you are experienced with
writing kernel-mode drivers (which I am not) this could be a dangerous path.
Other helpers, if I am wrong please correct me so as not to lead him astray.
|
|
|
|
|
It may not apply to "all drives"
No idea which problem is being solved, but if you have to watch all drives, I'll doubt your good intentions.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
How do i count the number of rows from the data grid view and the number of rows to make an integer . The number of rows will be save for preparation.
|
|
|
|
|
|
I suspect that English is not your first language, but this question is very unclear. Please give more information about what you are trying to achieve and we may be able to help you.
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
The bigger issue is why are you still using VB6? It's been dead for quite a long time now.
Visual Studio Community Edition is free from here[^] and support VB.NET, C#, C++, ...
|
|
|
|
|
i am using a windows application to connect to a finger print scanning device.
at the moment i can connect to machine and download all the logs. (using this DLL Interop.zkemkeeper.dll)
from my PC, windows 7 32bit it is working but when i installed the application on windows server 2003
32bit i am not able to connect to reader.
i installed visual studio 2010 on server and tried to build the Application on the server to make sure no reference were missing.
but still i can not connect to the reader.
my question is why it connects and can even downloads all the logs from my pc but it doesnt work on server (windows server 2003 32bit)
reader IP 192.168.0.1 port: 4370.
Public axCZKEM1 As New zkemkeeper.CZKEM
code to connect to reader:
private sub ConnectToReader()
If txtIP.Text.Trim() = "" Or txtPort.Text.Trim() = "" Then
MsgBox("IP and Port cannot be null", MsgBoxStyle.Exclamation, "Error")
Return
End If
Dim idwErrorCode As Integer
Cursor = Cursors.WaitCursor
If btnConnect.Text = "Disconnect" Then
AxCZKEM1.Disconnect()
bIsConnected = False
btnConnect.Text = "Connect"
lblState.Text = "Current State:Disconnected"
Cursor = Cursors.Default
Return
End If
bIsConnected = AxCZKEM1.Connect_Net(txtIP.Text.Trim(), Convert.ToInt32(txtPort.Text.Trim()))
If bIsConnected = True Then
btnConnect.Text = "Disconnect"
btnConnect.Refresh()
lblState.Text = "Current State:Connected"
iMachineNumber = 1
axCZKEM1.RegEvent(iMachineNumber, 65535)
Else
AxCZKEM1.GetLastError(idwErrorCode)
MsgBox("Unable to connect the device,ErrorCode=" & idwErrorCode, MsgBoxStyle.Exclamation, "Error")
End If
Cursor = Cursors.Default
End Sub
|
|
|
|
|
Make sure you've registered the SDK on the 2003 server. Copy all of the SDK files to the %windir%\system32 folder, and then run:
regsvr32.exe %windir%\system32\zkemkeeper.dll
If that doesn't fix it, then you're going to need to tell us what errors you're getting.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you.
I copied the dll I was referring to but it didn’t work. Then I copied all the dll (5 or 6 files I think). Once I copied all those dlls now it is working.
|
|
|
|
|
Dim DateAsString As New ArrayList
this is the part i am using in form load to get all the dates for the Meeting.
private sub getalldate()
Dim connectionString As String = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MyDB;Data Source=192.168.0.8"
Dim connection As SqlConnection = New SqlConnection(connectionString)
connection.Open()
Dim sql As String = "SELECT MeetingDate FROM Meetings"
Dim command As SqlCommand = New SqlCommand(sql, connection)
Dim reader As SqlDataReader = command.ExecuteReader()
If (reader.Read()) Then
If (reader.HasRows) Then
While reader.Read()
dateasstring.Add("#" & reader(0) & "#")
End While
End If
End If
reader.Close()
connection.Close()
end sub
private sub makedatesboldincalendar()
Dim num As Date
Dim dtArrSpecialDates() As Date
For Each num In dateasstring
dtArrSpecialDates = {num}
MonthCalendar1.BoldedDates = dtArrSpecialDates
Next
end sub
what happens is it makes date bold but only the last date it is getting from database. there are more than 10
entries in the Meetings table.
so, how can i highligh all the dates i am getting from database?
|
|
|
|
|
|
how can I make all the dates thats coming from the database as bold in the calendar?
|
|
|
|
|
Read the documentation and implement your code in the way shown.
|
|
|
|
|
Don't use ArrayList ; use List<DateTime> .
Don't convert the dates to strings; keep them as DateTime .
Don't loop over the array setting the BoldedDates for each element; just set the BoldedDates to the list of dates.
Don't call .Read before testing whether the data reader has any rows; you're skipping the first row.
Private AllDates As DateTime()
Private Sub GetAllDate()
Const connectionString As String = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MyDB;Data Source=192.168.0.8"
Const sql As String = "SELECT MeetingDate FROM Meetings"
Using connection As New SqlConnection(connectionString)
connection.Open()
Using command As New SqlCommand(sql, connection)
Using reader As SqlDataReader = command.ExecuteReader()
Dim dates As New List(Of DateTime)()
While reader.Read()
dates.Add(reader.GetDateTime(0))
End While
AllDates = dates.ToArray()
End Using
End Using
End Using
End Sub
Private Sub MakeDatesBoldInCalendar()
MonthCalendar1.BoldedDates = AllDates
End Sub
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
i have managed to do it.
but really appreciate that you have explained so well and gave code too.
hopefully some other user will find it useful.
thank you.
|
|
|
|
|
Psst to thank him properly up vote the answer - arrows appear top left of the answer box.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
have clicked the green arrow
|
|
|
|
|
how to create a VB ActiveX interface. any link to this appreciated
Thanks,
|
|
|
|
|
That is not a question that can be answered in a few words. You should head over to Google[^] and find some useful articles/tutorials.
|
|
|
|
|
In a vb.net desktop application, I want to find the substring value of '896', '558957', '5/2/2016', '3150', '1', '018.99', '', '18.99', '8277', '17', '12/4/2017', '1789655895720160502315018.99', 'Y'
that is contained with a 'sqlid' string field.
An example of the field that comes in is the following:
"INSERT INTO tblInvoiceData(SchNum,InvNum,InvDate,ItemNum, Quantity,UnitPrice,Credit,Amount,VendorId,CatId,Boarddate,RecordId,Imported )VALUES ('896', '558957', '5/2/2016', '3150', '1', '018.99', '', '18.99', '8277', '17', '12/4/2017', '1789655895720160502315018.99', 'Y')"
.
I want to display these values so the user of the application can find the record within the input file that is causing the error. This message is
displayed basically when there are duplicate records.
Thus can you show me the code in vb.net on how to accomplish my goal?
|
|
|
|
|
You need to write an SQL SELECT query to find all records containing those values. Or just get a subset and manually check for the others. And, saving date values as text strings in a database is not the best design.
|
|
|
|
|
Can you show me the query you are referring to?
The values you see come in from a text input file from the user. Thus there are no direct dates being accessed directly from the database
|
|
|
|
|
dcof wrote: Can you show me the query you are referring to? I already told you, it will need to be a SELECT statement. And I am afraid your second sentence above does not make sense. Your INSERT statement is clearly inserting date values as strings.
|
|
|
|
|
If I've understood what you're asking for, you have a string containing an INSERT command, and you want to extract the values.
The best way to do that would be with a Regular Expression:
Regular Expression Language - Quick Reference | Microsoft Docs[^]
For example:
Public Class StatementInfo
Private ReadOnly Shared Parser As New Regex(
"INSERT\s+(INTO\s+)?(?<table>[^(]+)\s*\((?<col>[^,)]+)(,\s*(?<col>[^,)]+))*\)\s*VALUES\s*\((?<val>[^,)]+)(,\s*(?<val>[^,)]+))*\)",
RegexOptions.IgnoreCase Or RegexOptions.ExplicitCapture)
Public Shared Function Parse(ByVal input As String) As StatementInfo
Dim match As Match = Parser.Match(input)
If Not match.Success Then Return Nothing
Dim tableName As String = match.Groups("table").Value
Dim columnNames As List(Of String) = match.Groups("col").Captures.Cast(Of Capture)().Select(Function (c) c.Value.Trim()).ToList()
Dim values As List(Of String) = match.Groups("val").Captures.Cast(Of Capture)().Select(Function (c) c.Value.Trim()).ToList()
If values.Count <> columnNames.Count Then Throw New ArgumentException("Mis-matched columns and values")
Return New StatementInfo(tableName, columnNames, values)
End Function
Private Sub New(ByVal tableName As String, ByVal columnNames As List(Of String), ByVal values As List(Of String))
Me.TableName = tableName
Me.Values = columnNames _
.Zip(values, Function (c, v) New With { .Key = c, .Value = v }) _
.ToDictionary(Function (p) p.Key, Function (p) p.Value, StringComparer.OrdinalIgnoreCase)
End Sub
Public ReadOnly Property TableName As String
Public ReadOnly Property Values As IReadOnlyDictionary(Of String, String)
End Class Usage:
Dim line As String = "INSERT INTO tblInvoiceData(SchNum,InvNum,InvDate,ItemNum, Quantity,UnitPrice,Credit,Amount,VendorId,CatId,Boarddate,RecordId,Imported )VALUES ('896', '558957', '5/2/2016', '3150', '1', '018.99', '', '18.99', '8277', '17', '12/4/2017', '1789655895720160502315018.99', 'Y')"
Dim statement As StatementInfo = StatementInfo.Parse(line)
If statement IsNot Nothing Then
Console.WriteLine("Table: {0}", statement.TableName)
For Each pair As KeyValuePair(Of String, String) In statement.Values
Console.WriteLine("{0} = {1}", pair.Key, pair.Value)
Next
End If Output:
Table: tblInvoiceData
SchNum = '896'
InvNum = '558957'
InvDate = '5/2/2016'
ItemNum = '3150'
Quantity = '1'
UnitPrice = '018.99'
Credit = ''
Amount = '18.99'
VendorId = '8277'
CatId = '17'
Boarddate = '12/4/2017'
RecordId = '1789655895720160502315018.99'
Imported = 'Y'
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|