Dot Net Framework
A)
Write ASP.Net program that displays the names of some flowers in two columns.
Bind
a label to the RadioButtonList so that when the user selects an option from the
list
and
clicks on a button, the label displays the flower selected by the user.
Answer :
Output :
B)
Write a VB.NET program to create movie table (Mv_Name, Release_year,
Director).
Insert the records (Max: 5). Delete the records of movies whose release year
is
2022 and display appropriate message in message box.
Answer :
Imports System
Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\Users\Saurabh\Desktop\New folder\movie.accdb")
Dim adpt As New OleDbDataAdapter("Select
* from movie", con)
Dim cmd As New OleDbCommand
Dim ds As New DataSet
Public Function display()
adpt.Fill(ds, "movie")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "movie"
Return ds
End Function
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
display()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
cmd.Connection = con
cmd.CommandType = CommandType.Text
cmd.CommandText = "insert into movie values('" & TextBox1.Text & "'," & TextBox2.Text & ",'" & TextBox3.Text & "')"
con.Open()
If cmd.ExecuteNonQuery() Then
MessageBox.Show("Inserted Successfully...!")
End If
con.Close()
ds.Clear()
display()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
cmd.Connection = con
cmd.CommandType = CommandType.Text
cmd.CommandText = "DELETE FROM movie WHERE Release_year = " & TextBox2.Text
con.Open()
If cmd.ExecuteNonQuery() Then
MessageBox.Show("Deleted Successfully...!")
End If
con.Close()
ds.Clear()
display()
End Sub
End Class
Output :
No comments:
Post a Comment