Click here to Skip to main content
14,392,354 members
Rate this:
Please Sign up or sign in to vote.
See more:
Once again hello.....

I am puzzled as to why my iterator function stops when trying to add The code that should only read from the database to compare the hash in my string.

the code that I am trying to accommodate with the database uses exact string pattern matching with booyer moore and the cryptographic hash algorithm of each file being scanned.

I have seen many examples of how to do this type of search one name or one string at a time with a click event but have not seen any example for checking continuously through a filesystem.

Any advise would be greatly appreciated.

A small example of a file search type method or word as string to search if it matches a data row in a database would be perfect and would take me a long way.

thank you in advance
Dale 2012 2-Feb-12 11:49am
Ok I have come up with this but it still is not working.........

Imports System.Data.OleDb
Public Class Form1
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
cn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Admin\Desktop\File Enumerator VB.Net\bin\Debug\AVDatabaseX64.accdb;Persist Security Info=True")
Dim strSearch As String
strSearch = "Select * FROM [MD5 Hash Signature]"
cmd = New OleDbCommand(strSearch, cn)
dr = cmd.ExecuteReader
While dr.Read

If dr(1) = txtSearch.Text Then
Label2.Text = +1
End If
End While
End Sub
End Class

It comes up with an error:

The Microsoft Office Access database engine cannot find the input table or query 'MD5 Hash Signature'. Make sure it exists and that its name is spelled correctly.
Dale 2012 2-Feb-12 11:54am
If I fix the line: strSearch = "Select * FROM [MD5 Hash Signature]"


strSearch = "Select * FROM MD5 Hash Signature"

I get an error:

Syntax error in FROM clause.


1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

It's telling you that you don't have a table in the database named (exactly!) "MD5 Hash Signature". Putting the square brackets around the name tells the query processor that the table name either has spaces in it (BAD IDEA!) or a a reserved word being used as an object name (another BAD IDEA!).

All you have to do is open the database and look at the table names to know for sure.
Dale 2012 2-Feb-12 21:03pm
well........ I do have two tables .... do i need to first name the table and then the column row of the table?
Dave Kreskowiak 2-Feb-12 22:39pm
You don't know anything about SQL do you?? I would seriously pickup a book on it or on Access before you continue.

The very simplified format for a SELECT statement is:

SELECT columnName1,columnName2,columnNameN, ... FROM tableName WHERE filterExpression
Dale 2012 3-Feb-12 19:23pm
Do you normally ask questions to which you know the answers?. I thank you for the response but am tired of hearing the expression "pick up a book" lol its the age of computers and the internet is a much better resource than any book I have ever read.

Is this site not for asking questions?......
Dave Kreskowiak 3-Feb-12 19:29pm
Do you normally ask questions to which you know the answers? Always.

Yeah, but the problem with the Internet is you don't get the complete story all at once. You get little pieces of information, both good AND BAD, from everywhere and it's up to you to filter out the bad and stitch the good together, hopefully in the correct order.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100