VBSlip 7_2_2015-16



===============================Slip 7_2================================== Write a VB Program to accept the details of employee from user & store those details in to the database. (Don’t use Standard controls) Employee having fieldsemp_code, emp_name, salary, dateofjoining.
=======================================================================
 


Dim ad As ADODB.Connection
Dim rst As ADODB.Recordset
Dim sql As String

Private Sub Command1_Click()    'Add New

                Text1.Text = ""
                Text2.Text = ""
                Text3.Text = ""
                Text4.Text = ""
End Sub
Private Sub Command2_Click()       'Save
                rst.AddNew
                rst!empcode = CInt(Text1.Text)
                rst!empname = Text2.Text
                rst!salary = CDbl(Text3.Text)
                rst!doj = CDate(Text4.Text)
                rst.Update
                rst.Requery
                MsgBox ("Data Inserted")
End Sub

Private Sub Command3_Click()
                rst.MoveFirst
                Call loadData
End Sub

Private Sub Command4_Click()
                rst.MoveLast
                Call loadData
End Sub

Private Sub Form_Load()
                Set ad = New ADODB.Connection
               
                ad.ConnectionString = "DSN=DBemp"   'must be created before use from control panel
                ad.Open
                MsgBox ("Open")
 

1 comment:

Note: only a member of this blog may post a comment.