Imports System.Date
Imports System.Date.SqlClient
Dim connection As New SqlConnection("al rabt")
Dim query As String
query = "insert into Patient values ('" & TextBox1.Text & "', '" & TextBox2.Text & "', '" & TextBox3.Text & "')"
query = "delete from patient where ID = '" & TextBox1.Text & "' "
query = "Update patient set name='" & TextBox2.Text & "', Phone = '" & TextBox3.Text & "' where ID = '" TextBox1.Text & "' "
Dim command As New Sqlcommand(query, connection )
only on insert
connection.open()
command.ExecuteNonQuery()
MsgBox("Success")
connection.Clouse()
Catch ex As Exception
connection.Clouse()
MsgBox("Failure")
Try
connection.open()
If (command.ExecuteNonQuery () <> 0) Then
MsgBox("Success")
Else
MsgBox("Query is executed no were deleted")
connection.Clouse()
Catch ex As Exception
connection.Clouse()
MsgBox("Failure")
End try
End sub
End class
select * from PC
delete from PC where ID=4
insert into PC values(4, 'macbook' 1020.50)
select * from PC