You are on page 1of 4

1. Studdisplay.

vb - general

Imports System.Data.SqlClient
Public Class studdisplay
Dim myconnection As SqlConnection
Dim mycommand As SqlCommand
Dim ra As Integer

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
myconnection = New SqlConnection("server=DELL;database=sailee;
Trusted_Connection=True")
myconnection.Open()
mycommand = New SqlCommand("select * from student_data where ID=" & TextBox7.Text
& "", myconnection)
Dim reader As SqlDataReader = mycommand.ExecuteReader()
While reader.Read()
Label9.Text = reader("first_Name").ToString()
Label10.Text = reader("last_Name").ToString()
Label11.Text = reader("addr").ToString()
Label12.Text = reader("contact_no").ToSting()
Label13.Text = reader("birthdate").ToString()
Label14.Text = reader("college").ToString()
Label15.Text = reader("percentage").ToString()
End While
myconnection.Close()


End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Hide()
studid.Show()

End Sub
End Class

2. Compdetails.vb general

Imports System.Data.SqlClient
Public Class compdetails
Dim myconnection As SqlConnection
Dim mycommand As SqlCommand
Dim ra As Integer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Hide()
compadd.Show()

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Hide()
compupdate.Show()

End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim a As Integer
myconnection = New
SqlConnection("server=DELL;database=sailee;Trusted_connection=True")
a = InputBox("Enter id")
myconnection.Open()
mycommand = New SqlCommand("Delete from Company_data where ID=" & a & " ",
myconnection)
ra = mycommand.ExecuteNonQuery()
MessageBox.Show("Row deleted" & ra)
myconnection.Close()

End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Me.Hide()
compdisplay.Show()

End Sub

Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
Me.Hide()
studdisplay.Show()

End Sub
End Class

3. Compdisplay general

Imports System.Data.SqlClient
Public Class compdisplay
Dim myconnection As SqlConnection
Dim mycommand As SqlCommand
Dim ra As Integer

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Hide()
compid.Show()


End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
myconnection = New SqlConnection("server=DELL;database=sailee;
Trusted_Connection=True")
myconnection.Open()
mycommand = New SqlCommand("select * from student_data where ID=" & TextBox7.Text
& "", myconnection)
Dim reader As SqlDataReader = mycommand.ExecuteReader()
While reader.Read()
Label9.Text = reader("company_Name ").ToString()
Label10.Text = reader("addr").ToString()
Label12.Text = reader("contact_no").ToSting()
Label15.Text = reader("intake").ToString()
End While
myconnection.Close()



End Sub

Private Sub TextBox7_TextChanged(sender As Object, e As EventArgs) Handles
TextBox7.TextChanged

End Sub
End Class

4. Compupdate general

Imports System.Data.SqlClient
Public Class compupdate
Dim myconnection As SqlConnection
Dim mycommand As SqlCommand
Dim ra As Integer

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
myconnection = New
SqlConnection("server=DELL;database=sailee;Trusted_Connection=True")
myconnection.Open()
mycommand = New SqlCommand("Update Company_data set company_name='" &
TextBox1.Text & "',addr='" & TextBox3.Text & "',contact_no='" & TextBox4.Text &
"',intake='" & TextBox6.Text & "' where ID='" & TextBox2.Text & "'", myconnection)

ra = mycommand.ExecuteNonQuery
MsgBox("Update successful")
myconnection.Close()
End Sub
End Class

5. Studupdate general

Imports System.Data.SqlClient
Public Class studupdate
Dim mycommand As SqlCommand
Dim myconnection As SqlConnection
Public Shadows a As Integer

Dim ra As Integer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
myconnection = New
SqlConnection("server=DELL;database=sailee;Trusted_Connection=True")
myconnection.Open()
mycommand = New SqlCommand("Update student_data set first_name='" & TextBox1.Text
& "',last_name='" & TextBox2.Text & "',Addr='" & TextBox3.Text & "',contact_no='" &
TextBox4.Text & "',birthdate='" & DateTimePicker1.Value & "',college='" & TextBox5.Text &
"', percentage='" & TextBox6.Text & "' where ID='" & TextBox7.Text & "'", myconnection)

ra = mycommand.ExecuteNonQuery
MsgBox("Update successful")
myconnection.Close()

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Hide()
studadd.Show()

End Sub

Private Sub stud4_Load(sender As Object, e As EventArgs) Handles MyBase.Load

End Sub

Private Sub TextBox7_TextChanged(sender As Object, e As EventArgs) Handles
TextBox7.TextChanged

End Sub

Private Sub Label8_Click(sender As Object, e As EventArgs) Handles Label8.Click

End Sub

Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles
TextBox1.TextChanged

End Sub

Private Sub DateTimePicker1_ValueChanged(sender As Object, e As EventArgs) Handles
DateTimePicker1.ValueChanged

End Sub
End Class

You might also like