Imports [Link].
SqlClient
Public Class Form1
Dim query As String = "server=(localdb)\Projects;database=dbprofile"
Dim con As New SqlConnection(query)
Sub loaddata()
Dim query As String = "select * from profile"
Dim adpt As New [Link](query, con)
Dim ds As New DataSet()
[Link](ds, "Emp")
[Link] = [Link](0)
[Link]()
[Link]()
[Link]()
[Link]()
[Link]()
[Link]()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles [Link]
loaddata()
End Sub
Private Sub btnInput_Click(sender As Object, e As EventArgs) Handles
[Link]
Dim cmd As SqlCommand
[Link]()
Try
cmd = [Link]
[Link] = "Insert into
profile(id,name,email,website)values(@id,@name,@email,@website);"
[Link]("@id", [Link])
[Link]("@name", [Link])
[Link]("@email", [Link])
[Link]("@website", [Link])
[Link]()
loaddata()
Catch ex As Exception
End Try
End Sub
Private Sub DataGridView1_CellContentClick_1(sender As Object, e As
DataGridViewCellEventArgs) Handles [Link]
Dim row As DataGridViewRow = [Link]
Try
[Link] = [Link](0).[Link]()
[Link] = [Link](1).[Link]()
[Link] = [Link](2).[Link]()
[Link] = [Link](3).[Link]()
Catch ex As Exception
End Try
End Sub
Private Sub btnUpdate_Click(sender As Object, e As EventArgs) Handles
[Link]
Dim cmd As SqlCommand
[Link]()
Try
cmd = [Link]()
[Link] = "Update profile set
id=@id,name=@name,email=@email,website=@website"
[Link]("@id", [Link])
[Link]("@name", [Link])
[Link]("@email", [Link])
[Link]("@website", [Link])
[Link]()
loaddata()
Catch ex As Exception
End Try
End Sub
Private Sub btnDelete_Click(sender As Object, e As EventArgs) Handles
[Link]
Dim cmd As SqlCommand
[Link]()
Try
cmd = [Link]()
[Link] = "Delete from profile where id=@id;"
[Link]("@id", [Link])
[Link]()
loaddata()
Catch ex As Exception
End Try
End Sub
Private Sub txtSearch_TextChanged(sender As Object, e As EventArgs) Handles
[Link]
Dim adapter As SqlDataAdapter
Dim ds As New DataSet
Try
[Link]()
adapter = New SqlDataAdapter("Select * from profile where name like '%"
& [Link] & "%'", con)
[Link](ds)
[Link] = [Link](0)
[Link]()
[Link]()
[Link]()
[Link]()
[Link]()
Catch ex As Exception
End Try
End Sub
Private Sub btnReset_Click(sender As Object, e As EventArgs) Handles
[Link]
loaddata()
End Sub
End Class