Results 1 to 7 of 7

Thread: [VB6] Search about Strings using Ado

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2018
    Posts
    23

    Exclamation [VB6] Search about Strings using Ado

    Hi all
    I am working on a program that needs database, I usually use Ado or Data. I see that Ado is more and more Easily. BUT, I need to search in some fields about string data, and I get faults..
    I need a way to search using Ado about Strings.
    Thanks, Eng27

  2. #2
    gibra
    Guest

    Re: [VB6] Search about Strings using Ado

    Shows your code.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2018
    Posts
    23

    Re: [VB6] Search about Strings using Ado

    This is my code:
    Adodc1.Refresh
    Adodc1.RecordSet.Find "Name=" & Text1.Text
    .
    When I use this code it doesn't work. but when I search in the field id (which contain numeric data) and search about Val(Text1.Text) It works perfectly..
    WHY?!

  4. #4
    gibra
    Guest

    Re: [VB6] Search about Strings using Ado

    See the Database Development FAQs & Tutorials - Database system specific:
    http://www.vbforums.com/showthread.p...ed-May-13-2011

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jan 2018
    Posts
    23

    Re: [VB6] Search about Strings using Ado

    Quote Originally Posted by gibra View Post
    See the Database Development FAQs & Tutorials - Database system specific:
    http://www.vbforums.com/showthread.p...ed-May-13-2011
    oh Thanks

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: [VB6] Search about Strings using Ado

    try
    Code:
    Adodc1.RecordSet.Find "Name='" & Text1.Text & "'"
    string field types need to be enclosed in ' '
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Jan 2018
    Posts
    23

    Re: [VB6] Search about Strings using Ado

    Quote Originally Posted by westconn1 View Post
    try
    Code:
    Adodc1.RecordSet.Find "Name='" & Text1.Text & "'"
    string field types need to be enclosed in ' '
    Great.. Thanks a lot, this is reasonable..

Tags for this Thread

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