Click to See Complete Forum and Search --> : using string in database field


jihan13
September 18th, 2001, 11:33 PM
I store a line of string (0011..) in a filed in Access Database. I want to retrieve this field and to store it in an array which array1(1)=0, array1(2)=0 array1(3)=1 and so on... And after that, I will make a comparison between two array, array1 and array2.

What must I do?

Thank You

Cakkie
September 19th, 2001, 01:31 AM
You can use the strConv function to get an array.

arr1 = StrConv(strLine1, vbToUnicode)
arr2 = StrConv(strLine2, vbToUnicode)



This gives you a byte array however, so the values are numeric instead of string, but that doesn't matter when comparing

for T=0 to Ubound(arr1)
If arr1(t) = arr2(t) then
Match = Match + 1
End If
Msgbox round((match / ubound(arr1) * 100) ,2) & "% of the arrays match"
next T





Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook

jihan13
September 19th, 2001, 08:22 PM
Thank You for that.But, I'm will retrieve the data from the field in database and put it in array befaore compare it.

Cakkie
September 20th, 2001, 01:04 AM
Well, what I used were just plain strings, so if you get the data from the database into the strings, you're done

strLine1 = rst("SomeField")
strLine2 = rst("SomeOtherField")




Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook