Option Explicit
Public rs As New ADODB.Recordset
Public cmd As New ADODB.Command
Public con As New ADODB.Connection
Public Sub OpenConn()
With con
.CursorLocation = adUseClient
.ConnectionString = "Provider=MSDAORA.1;Password=praem;User ID=praem;Data Source=127.0.0.1;Persist Security Info=True"
.Open
End With
End Sub
Private Sub Form_Load()
OpenConn
With rs
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.CacheSize = 50
.Source = "Select * from students"
.ActiveConnection = "Provider=MSDAORA.1;Password=praem;User ID=praem;Data Source=127.0.0.1;Persist Security Info=True"
.Open
End With fillforms lock_edit save.Enabled = False
End Sub
Private Sub fillforms()
If Not (rs.EOF = True Or rs.BOF = True) Then rno.Text = rs(0) student.Text = rs(1) fname.Text = rs(2) phno.Text = rs(3) email.Text = rs(4)
Me.branch.Text = rs(5) sem.Text = rs(6) street.Text = rs(7) city.Text = rs(8) district.Text = rs(9) state.Text = rs(10) pincode.Text = rs(11) dob.Value = rs(12) doj.Value = rs(13)
Else
MsgBox "This is the last Record or the first Record", vbOKOnly, "Cannot Move"
End If
End Sub
Private Sub Form_Unload(Cancel As Integer) college.Show
End Sub
Private Sub Label1_Click()
End Sub
Private Sub nex_Click()
If Not (rs.EOF = True) Then rs.MoveNext fillforms
End If
End Sub
Private Sub prev_Click()
If Not (rs.BOF = True) Then rs.MovePrevious fillforms
End If
End Sub
Private Sub first_Click()
If Not (rs.BOF = True) Then rs.MoveFirst fillforms
End If
End Sub
Private Sub last_Click()
If Not (rs.EOF = True) Then rs.MoveLast fillforms
End If
End Sub
Private Sub add_Click()
If add.Caption = "New" Then unlock_edit nul_text add.Caption = "add" delete.Caption = "Cancel" edit.Enabled = False save.Enabled = False first.Enabled = False