AIM:
To display the personal details for an employee using ADO control.
PROCEDURE:
Step 1 : Create a standard exe project.
Step 2 : Click on adding options from the menu bar.
Step 3 : Click visual manager→ click file → click new → Microsoft access version
7.4Mdb.
Step 4 : Enter the database name and save it in the desired location.
Step 5 : Right click the properties in the database window and click new table, enter
table name and add the fields.
Step 6 : Then go to form and place an necessary label, text box and command button
Place an ADO control components → Microsoft ADO control 6.1.
Step 7 : Right a corresponding codes for all the buttons and run the program.
SOURCE CODE
Dim A As ADODB.Connection
Dim b As ADODB.Recordset
Dim I As Integer
Private Sub ADD_Click()
Me.Combo1.Text = STUD_ID
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
b.AddNew
MsgBox "YOU WANT TO ADD NEW DATA"
End Sub
Private Sub Combo1_Click()
If Text1.Text = b.Fields(0) Then
Text2.Text = b.Fields(1).Value
Text3.Text = b.Fields(2).Value
Text4.Text = b.Fields(3).Value
Text5.Text = b.Fields(4).Value
End If
End Sub
Private Sub Command1_Click()
End
End Sub
Private Sub Command2_Click()
If b.EOF = False Then
b.MovePrevious
End If
End Sub
Private Sub Command4_Click()
'Text1.Visible = False
'b.Update
End Sub
Private Sub Command5_Click()
b.Delete
End Sub
Private Sub Command6_Click()
Me.Combo1.Text = STUD_ID
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
End Sub
Private Sub Form_Load()
Set A = New ADODB.Connection
A.Provider = "Microsoft.jet.Oledb.4.0"
A.Open "D:\IMCA'A'\VB\EX7\STUD.mdb"
Set b = New ADODB.Recordset
b.Open "select *from SAR", A, adOpenDynamic, adLockOptimistic
End Sub
Private Sub FST_Click()
b.MoveFirst
Text1.Text = b.Fields(0).Value
Text2.Text = b.Fields(1).Value
Text3.Text = b.Fields(2).Value
Text4.Text = b.Fields(3).Value
Text5.Text = b.Fields(4).Value
End Sub
Private Sub LST_Click()
b.MoveLast
Combo1.Text = b.Fields(0).Value
Text2.Text = b.Fields(1).Value
Text3.Text = b.Fields(2).Value
Text4.Text = b.Fields(3).Value
Text5.Text = b.Fields(4).Value
End Sub
Private Sub NEX_Click()
b.MoveNext
If b.EOF Then
b.MoveLast
End If
Text1.Text = b.Fields(0).Value
Text2.Text = b.Fields(1).Value
Text3.Text = b.Fields(2).Value
Text4.Text = b.Fields(3).Value
Text5.Text = b.Fields(4).Value
End Sub
Private Sub PRE_Click()
b.MovePrevious
If b.BOF Then
b.MoveFirst
End If
Combo1.Text = b.Fields(0)
Text2.Text = b.Fields(1).Value
Text3.Text = b.Fields(2).Value
Text4.Text = b.Fields(3).Value
Text5.Text = b.Fields(4).Value
End Sub
Private Sub SAVE_Click()
b.Fields(0).Value = Me.Text1.Text
b.Fields(1).Value = Text2.Text
b.Fields(2).Value = Text3.Text
b.Fields(3).Value = Text4.Text
b.Fields(4).Value = Text5.Text
b.Update
MsgBox "SUCCESSFULLY ADDED", vbInformation
End Sub
DATABASE:
SID | NAME | DEPT | DESIG | PAY |
07TI10 | NEVIN | TI59 | TESTING | Rs.35,000 |
08WI78 | PRABHU | WE06 | SOFT.ER | Rs.35,000 |
05DI79 | ARUN | DI05 | DESIGNER | Rs.35,000 |
05UI77 | SARAVANA | UI88 | PROJ.LEADER | Rs.50,000 |
06TI13 | VINODH | TI13 | COACHER | Rs.35,000 |
SCREEN LAYOUT


0 comments:
Post a Comment