CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2010
    Posts
    3

    Question vb.net, Adodc.recordsource, Sql Search Problem

    Friends I have Developed my Data base Project on vb6, using adodc and datagrid using ms access database file, it was working nice in vb6, I also put Search box there and used adodc1.recordsource="select * from table" sql query.

    later i needed to convert it in vb.net
    I converted it, every thing is working fine, but one problem appears, an adodc's Recordsource query for searching records is not working, it only works if there is data in dataset (Datagrid),

    suppose once i pressed search button to search record and if no record found then dataset / datagrid becomes empty, now i wanted to search an other record with other name, but this time it does not work and following error appears

    Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

    my question is how to solve above mentioned error, or reload my data into datagrid so that i may search again what i want to.

    Please Help with this Problem

    the code to search for specific record i m using is
    Code:
            Adodc1.RecordSource = "Select * from Records Where Name like'" & Text17.Text & "%'"
    
            Adodc1.CommandType = ADODB.CommandTypeEnum.adCmdText
            Adodc1.Refresh()
    and in vb6 (before Conversion) it was
    Code:
           Adodc1.RecordSource = "Select * from Records Where Name like'" & Text17.Text & "%'"
    
            Adodc1.CommandType = adCmdText
            Adodc1.Refresh()
    Please Help how to solve above mentioned error, or how to reload data in dataset (data grid, in my case)
    Last edited by Cimperiali; March 4th, 2010 at 07:44 AM. Reason: Added Code Tags

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: vb.net, Adodc.recordsource, Sql Search Problem

    Go back and add Code Tags so we can read your code.
    Code:
    ' like THIS
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

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

Featured