CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: ADO

  1. #1
    Join Date
    Apr 2001
    Location
    Orlando, Florida
    Posts
    17

    ADO

    HELLO ALL,

    i don't know how to explain this...but basically i have databound-textbox controls associated with my ado object that show the current record, now when i search for a specific record i want to update my view to show me the searched criteria, that is the last name and update all the other textboxes to the values corresponding to the lastname. Something like making my ado recordset move to the searched value.

    here is what i have but it just renames the name in the lastName field to the searched value.


    Private Sub mnuSearch_Click()
    Dim pstrLastName As String
    Dim sql As String


    pstrLastName = InputBox("Enter name", "Find")

    If pstrLastName <> "" Then

    sql = "SELECT * FROM Employees WHERE LastName = " & Chr(34) & pstrLastName & Chr(34)

    data.con.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\CaseStudies\Mscb.mdb;Persist Security Info=False")


    data.record.Open sql, data.con

    If data.record.EOF = True Then
    MsgBox ("there are no records")
    Else


    txtFields(2).Text = data.record!LastName

    End If

    data.record.Close
    data.con.Close

    End If
    End Sub

    THANK YOU ,
    FATIMA



  2. #2
    Join Date
    Apr 2001
    Location
    CA
    Posts
    153

    Re: ADO

    what is this ado object you have? how is it associated with your textboxes? do you ever get data in your textboxes? if so, what code do you use to get the initial data?

    thanx/good luck,
    adam
    thanx/good luck

  3. #3
    Join Date
    Mar 2001
    Posts
    11

    Re: ADO

    U are already displaying the value of the search to the textbox(2).

    Similiarly display the other fields of the recordset to the remaining textboxes, just as u did for LastName. U have already done the filtering. So u should have the required data in ur recordset


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