#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    51
    Rep Power
    12

    The current row is not available.


    I get this error message when I try to edit a datagrid that is bound to a sql server database. Any ideas?

    Thanks!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    How was your cursor opened? Forward only? Updateable?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    51
    Rep Power
    12
    adOpenStatic

    And I only get the error on this field. I can update other fields as needed.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    What is the data type for the field?
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    51
    Rep Power
    12
    Its a varchar type in ms sql server.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    Can you edit any other VARCHAR fields in this same row?
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    51
    Rep Power
    12
    Yes, with no problem. The interesting thing is, though, that this grid is bound to the data source in code (rather than with an adodc) and is sitting on a mdichild form. When I edit other fields I run some validation on them and sometimes the msg box that indicates the user has entered incorrect data doesn't show up. I think it is behind the child form? I don't know but I hear the beep and if I hit enter the program continues to run.

    Pretty bizarre I think.
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    Are there any data constraints, checks or Foreign key relationships on the target field? Can you update field directly or through a query?
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    51
    Rep Power
    12
    Here is the query that I use to populate the grid with:

    [vb]

    'get data source for display
    sql = "SELECT * FROM PartData pd INNER JOIN RaceData rd ON pd.RaceID = rd.RaceID "
    sql = sql & "WHERE rd.EventID = " & lEventID & " ORDER BY pd.LastName"
    Set rs = New Recordset
    rs.Open sql, conn, adOpenStatic, adLockOptimistic
    Set dgPartData.DataSource = rs

    [/vb]

    Here is how I write to the recordset itself:

    [vb]

    'insert into db
    sql = "INSERT INTO PartData (RaceID, FirstName, LastName, Bib, Gender, Age, Address, "
    sql = sql & "City, State, Zip, Phone, Email, ShrtSize, ShrtStyle, WhereReg, DateReg, "
    sql = sql & "DOB, Team, Seed, SeedTime, AmtPaid, AgeGroup, Clydesdale, Wheelchair, RaceWalk) "
    sql = sql & "VALUES (" & ThisRaceID(lstRace, lstRace.Text) & ", '" & txtFirstName & "', '"
    sql = sql & txtlastName & "', '" & txtBib & "', '" & lstGender & "', " & RaceDayAge & ", '"
    sql = sql & txtAddress & "', '" & txtCity & "', '" & txtState & "', "
    sql = sql & lZip & ", '" & txtPhone & "', '" & txtEmail & "', '" & lstShrtSize & "', '"
    sql = sql & lstShrtStyle & "', '" & lstWhereReg & "', '" & Date & "', '" & txtDOB & "', '"
    sql = sql & txtTeam & "', '" & txtSeed & "', '" & txtSeedTime & "', '" & txtEntryFee & "', '"
    sql = sql & AgeGrp(RaceDayAge, lstGender.Text, ThisRaceID(lstRace, lstRace.Text)) & "', '"
    sql = sql & sClyde & "', '" & sWhlchr & "', '" & sRaceWalk & "')"
    Set rs = conn.Execute(sql)

    [/vb]

    All of this seems to work fine (except the gird is quirkly as I said in my last reply) except when I try to edit this field directly on the grid-that is when I get an error.

    Please don't hesitate to comment on my code if you think it could/should be written differently.

    Thanks!

IMN logo majestic logo threadwatch logo seochat tools logo