Results 1 to 7 of 7

Thread: [RESOLVED] Confused - date update causing - Row cannot be located for updating

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    23

    Resolved [RESOLVED] Confused - date update causing - Row cannot be located for updating

    Hi,

    I'm Using ADODB with mySQL. When updating if I exclude two dates on the update then all is ok, But if I changed them with the data from the screen and the recordset.update. I get the error that data has changed since you found it. I was wondering if anybody could help me out on a direction to look in, as I can't figure out why its the dates that are causing the issue. I am opening my recordset as follows

    pRs.Open SQL1, gCnn, adOpenStatic, adLockOptimistic, adCmdText

    thanks

    Anne
    Last edited by anneq; Jun 7th, 2006 at 03:30 PM.

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Confised date update causing - Row cannot be located for updating

    whats in SQL1?

    (lets see the SQL )
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    23

    Re: Confused date update causing - Row cannot be located for updating

    VB Code:
    1. SQL1 = "Select transplant.TDCSNO,transplant.TransplantNo,transplant.TransplantDate,transplant.TransplantStatus," _
    2.          & "DonorHospital," _
    3.          & "DonorCauseofDeath, DonorDOB,DonorAge,DonorAgeType," _
    4.          & "DonorSex, DonorAOB,Pressors,ColdIshaemicTm," _
    5.          & "KidneyUsed,ReferringCentre,TransplantPool," _
    6.          & "DateofFailure,CauseofFailure,DateofDeath,CauseofDeath," _
    7.          & "PancreasFunctioning,DatePancreasFailure," _
    8.          & "CausePancreasFailure,DatePancreasObsFunctioning,EsrdCode,NoDat," _
    9.          & "CMVRecipient,CMVDonor,Pairing," _
    10.          & "CMVInfection,CMVDate,BioTmToZero,BioGs,BioIF,Biopsy," _
    11.          & "AtnInterval,PoorClearence,DiabeticDet," _
    12.          & "LastCreat3,LastCreat2,LastCreat1,LastCreatYr3,LastCreatYr2,LastCreatYr1,CompDetails, " _
    13.          & "ReferringCenterCo,TreatmentCenter,TreatmentCenterCo,TreatmentCommenced,FollowupCenter, " _
    14.          & "FollowUpCenterCo,ReferringCons,FollowupCons,FollowUpMrn,ReferringMrn, " _
    15.          & "AddFailDetails,AddDeathDetails,InPatStay,PregnantDt,PregPreTx,BhCons,Rooms, " _
    16.          & "AgeAtTx, AgeTypeAtTx, DonorHospitalCo,ESRDDxSubtype,EDTADX, " _
    17.          & "DonorDetails, DrugDetails, ImmunoDetails,CreatDetails,PancreasDetails " _
    18.          & " From transplant  " _
    19.          & " where transplant.TDCSNo = '" & Trim$(TDCSPass) & "'" _
    20.          & " and transplant.TransplantNo = '" & Trim$(TransplantNoPass) & "'"

    I set the fields with the data from the screen as follows, If I comment out these lines then all is OK

    [Highlight=VB]
    rs.Fields("DateofFailure") = mskDtFail.Text

    rs.Fields("DateofDeath") = mskDateDeath.Text
    rs.update

    [VBCODE/]

    Does this help...If the data is not Null in the database then it updates OK, if the data is Null then it seems to have the problem.
    thanks

    Anne

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Confused - date update causing - Row cannot be located for updating

    WOW thats quite the SQL statement

    ok..
    if th DB is NULL in the date fields it wont update the date fields..
    but if its NOT NULL in the date fields it will update them???

    what if u try this?
    VB Code:
    1. rs.Fields("DateofFailure") = "" & mskDtFail.Text
    2.  
    3. rs.Fields("DateofDeath") = "" & mskDateDeath.Text
    seems odd.. ive run into errors trying to put null values IN but not updating NULL values...
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    23

    Re: Confused - date update causing - Row cannot be located for updating

    Thanks but no luck.... The default in the database is 0000-00-00 although the default value is null - would this have anything to do with it...

    Anne

  6. #6
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Confused - date update causing - Row cannot be located for updating

    I wouldnt think it would make any difference...

    is the Date in the textbox formatted properly?

    rs.Fields("DateofFailure") = format(mskDtFail.Text,"yyyy-mm-dd")
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    23

    Re: Confused - date update causing - Row cannot be located for updating

    Hiya,

    I set the date in the database to null (via sql) and now it works. If anybody comes accross this post and can let me know why I would be greatful. But for now I must close the post and go update mytables to null

    thanks for all your help

    Anne

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