|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
|
|||
|
|||
|
How was your cursor opened? Forward only? Updateable?
|
|
#3
|
|||
|
|||
|
adOpenStatic
And I only get the error on this field. I can update other fields as needed. |
|
#4
|
|||
|
|||
|
What is the data type for the field?
|
|
#5
|
|||
|
|||
|
Its a varchar type in ms sql server.
|
|
#6
|
|||
|
|||
|
Can you edit any other VARCHAR fields in this same row?
|
|
#7
|
|||
|
|||
|
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. |
|
#8
|
|||
|
|||
|
Are there any data constraints, checks or Foreign key relationships on the target field? Can you update field directly or through a query?
|
|
#9
|
|||
|
|||
|
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! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > The current row is not available. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|