Home > Software engineering >  Vb nested loop?
Vb nested loop?

Time:09-30


Rs_chaoqi is borrowed record collection
DataGrid1. Columns (3). CellValue (DataGrid1. Bookmark) is the only book number
My idea is that in borrowed record according to the number to find books than books, written to date, if the book was borrowed two times, recorded for the first time to a stop, the second date also can't write a book book,
Rs_chaoqi. MoveFirst

The Do While DataGrid1. Columns (3). CellValue (DataGrid1. Bookmark) & lt;> Rs_chaoqi. Fields (3)
Rs_chaoqi. MoveNext
Loop

Rs_chaoqi. Fields (7)=Date
Rs_chaoqi. Update


CodePudding user response:

Feel you realize return the book to register in this way, it is better to use the SQL update directly is better, but here don't say this, just say you now this implementation, on the basis of your code, it can be changed:
 Dim dteLatest As Date 
Rs_chaoqi. MoveFirst

The Do While datagrid1. Columns (3). CellValue (datagrid1. Bookmark) & lt;> Rs_chaoqi. Fields (3)
If (dteLatest & lt; Datagrid1. Columns (5). CellValue (datagrid1. A Bookmark) Then 'one by comparing the latest "lending date
"DteLatest=datagrid1. Columns (5). CellValue (datagrid1. Bookmark)
'there should be a code record corresponding to the latest "lending date" logo, such as a Bookmark
End the If
Rs_chaoqi. MoveNext
Loop
'a word should be changed to below, according to the latest "lending date" on the record of identity, positioning to the records, change the corresponding "also date
"Rs_chaoqi. Fields (7)=Date
Rs_chaoqi. Update
  • Related