Visual Basic : Slip 5b(calculate result and show in grid)
Dim CON As New ADODB.Connection Dim RS As New ADODB.Recordset Dim QUERY As String Private Sub Command1_Click() Dim TOT As Integer Dim PER As Single TOT = CInt(Text4.Text) + CInt(Text5.Text) + CInt(Text6.Text) PER = TOT \ 3 Text7.Text = TOT Text8.Text = PER If PER 70 Then Text9.Text = "dist" ElseIf PER 60 Then Text9.Text = "FIRST CLASS" ElseIf PER 50 Then Text9.Text = "SECOND CLASS" ElseIf PER 40 Then Text9.Text = "PASS CLASS" Else Text9.Text = "****" End If End Sub Private Sub Command2_Click() QUERY = "select * from student" RS.CursorLocation = adUseClient RS.Open QUERY, CON, adOpenDynamic, adLockOptimistic Set dg1.DataSource = RS Set RS = Nothing End Sub Private Sub Command3_Click() QUERY = "insert into student values(" & Text1.Text & ",'" & Text2.Text & "','" & Text3.Text & "'," & Text4.Text & "," & Text5.Text & "," & Text6.Text & "," & Text7.Text & "," & Text8.Text & ",'" & Text9.Text & "')" RS.Open QUERY, CON, adOpenDynamic, adLockOptimistic MsgBox "result saved" Set RS = Nothing End Sub Private Sub Form_Load() CON.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\BCA\2019_SYBCA_SCHOLARBATCH\VB\SLIP5B\COLLEGE.mdb;Persist Security Info=False" MsgBox "DATABASE CONNECTED" End Sub
Download
0 formatsNo download links available.