Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi, i want to know how to read sql database in vb6 and then compare two string to get the percentage similarity between the file? i am new to vb6 so i dont know how to start the coding..could someone please help me?
Posted

You might want this: http://en.wikipedia.org/wiki/Levenshtein_distance[^]

And there are plenty or articles about reading from a database on here, just look around.
 
Share this answer
 
Hi
You should read and learn this article.

http://www.dreamincode.net/forums/topic/24677-connecting-to-a-sql-server-database-using-adodb/[^]

Then implement your code to connect vb6 application and Sql server.

And code for percentage similarity between two strings as below.

VB
dim numMatch as integer = 0
dim numNotMatch as integer = 0
dim numCharLargestString as integer = 0
dim strFirstLength as integer
dim strSecondLength as integer
dim counter as integer
dim percentage as double
dim LoopControl as integer
dim str1 as string
dim str2 as string

strFirstLength = str1.Length()
strSecondLength = str2.Length()

if strFirstLength > strSecondLength
   loopControl = strSecondLength - 1
   numCharLargestString= strFirstLength

else LoopControl = strFirstLength - 1
      numCharLargestString= strSecondLength
endif


for counter = 0 to LoopControl
    if (string1(counter).compareTo(string2(i) = 0
        numMatch ++
    else numNotMatch ++
  end if
next

percentage = numMatch/numCharLargestString
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900