|
I am newbie and recently made a small MIS
The original modification function must be selected from the DataGrid3 and then modified.
Because the front desk provides users to change the password
So DataGrid3 is hidden when it is displayed, so it cannot be selected.
So you must locate the user's line in advance. The following is my method. However, read and read are the first line of data. Please help the master.
Private Sub newa ()
'definition
Dim olecn As New OleDbConnection ("Provider = Microsoft.Jet.OLEDB.4.0; Data Source = d:\data\Clients.mdb")
Dim olecm As New OleDbCommand ("select * from StudentUser", olecn)
Dim olead As New OleDbDataAdapter
Dim olerd As OleDbDataReader
Dim pd As Boolean = False 'Define boolean for later error handling
Dim i As Integer
olecm = New OleDbCommand ("select * from StudentUser", olecn)
'Establish a connection to the database
olecn.Open ()
olerd = olecm.ExecuteReader
'Loop judges whether the data in the database is the same
Do While olerd.Read ()
For i = 0 To olerd.FieldCount-1
If Trim (login.zhtl.Text) = (olerd.Item ("Usename")) Then
Me.DataGrid3.CurrentRowIndex = i
Exit Sub
End If
Next
Loop
End Sub |
|