« Previous Next »

Thread: Ado Recordset Update

Last post 06-13-2009 4:06 AM by steve schofield. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 06-13-2009, 3:12 AM

    • NewDev01
    • Not Ranked
    • Joined on 08-31-2008, 3:18 PM
    • Posts 1

    Ado Recordset Update

    Dim dbCon, sql, trandate, rsBatch, selectBatch, strconn

    Set dbCon = Server.CreateObject("ADODB.Connection")
    dbCon.open Session("strConn")
    dbCon.BeginTrans


    Set rsBatch = server.createobject("ADODB.Recordset")
    rsBatch.ActiveConnection = dbCon
    rsBatch.LockType = adLockOptimistic
    rsBatch.CursorLocation = adUseServer
    rsBatch.CursorType = adOpenKeyset
    selectBatch = "SELECT TextFld, TranDate from tab1"
    rsBatch.open selectBatch, dbCon
    rsBatch.AddNew
    rsBatch("TextFld") = "Some Text"
    rsBatch("TranDate") = "06/10/2009"
    rsBatch.Update

    dbCon.CommitTrans
    rsBatch.Close
    Set rsBatch = Nothing
    dbCon.Close

     


    Hi,

    The above code, till yesterday was working fine..All of a sudden, from today morning the "Trandate" field..Although i'm setting date in "06/10/2009"[mm/dd/yyyy] format..ado recordset update reformats to "10/06/2009"..but if i give CDate("06/10/2009") it works fine and take as "06/10/2009"...pls help me to sort out this..till yesterday it was working fine..it happen from today.. i checked the regional setting, nothing changed there.

    pls comment

    thanks

  • 06-13-2009, 4:06 AM In reply to

    Re: Ado Recordset Update

    Sounds like a change in locale on the server was make or some other machine setting, or update.  I would check with the provider or server admin.   It doesn't hurt to use the CDATE function, which ensures the data is actually a date.  I'd leave it personally.

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
Page 1 of 1 (2 items)
Microsoft Communities