CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2001
    Posts
    16

    using string in database field

    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



  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: using string in database field

    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
    [email protected]

    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
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  3. #3
    Join Date
    Sep 2001
    Posts
    16

    Re: using string in database field

    Thank You for that.But, I'm will retrieve the data from the field in database and put it in array befaore compare it.


  4. #4
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: using string in database field

    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
    [email protected]

    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
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured