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

Thread: ADODB.Recordset Update to ADO.NET

  1. #1
    Join Date
    Apr 2011
    Posts
    1

    ADODB.Recordset Update to ADO.NET

    Hello fellow Gurus. Let me start with a question.

    I have a piece of software I am converting to ADO.NET from ADODB.

    In ADODB I can update a recordset by simply.

    Dim rs as ADODB.Recordset

    rs = query("select * from tblSomethere where something = something")

    rs("something").Value = something.Text

    rs.Update()

    OR IF I WANTED TO ADD

    Dim rs as ADODB.Recordset

    rs.AddNew()

    rs = query("select * from tblSomethere where something = something")

    rs("something").Value = something.Text

    rs.Update()

    I am confused about to easily accomplish this. I know I can use an insert or update command but it would be much easier to do something like this. Thank you for any help!

    NOTE: The query just returns a filled RecordSet, it just executes the command and connection without me having to do it all over the place.

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

    Re: ADODB.Recordset Update to ADO.NET

    If it's a string, then this, otherwise date uses # and value doesn't use the quotes.


    Code:
    rs = query("select * from tblSomethere where something = _
                     & "'" & something.text & "')"
    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!

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)