Académique Documents
Professionnel Documents
Culture Documents
NET
Imports System.Data
Imports System.Data.SqlClient
Ds.Fill(dt)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
'=========ADD====================================
Try
Dim Con As New SqlConnection("Data Source=paxar_is;Initial Catalog=Esolution;uid=sa;pwd=")
Con.Open()
Dim Com As New SqlCommand("INSERT INTO Employee(Name,Dept,Salary)VALUES('" & TextBox1.Text &
"','" & TextBox2.Text & "','" & TextBox3.Text & "')", Con)
Com.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.ToString())
End Try
Response.Redirect("webform2.aspx")
End Sub
'===============DELETE==================
'============UPDATE=====================
Try
Dim con As New SqlConnection("Data Source=paxar_is;Initial Catalog=Esolution;uid=sa;pwd=")
con.Open()
Dim cmd As New SqlCommand("update employee set dept='" & TextBox2.Text & "',salary='" &
TextBox3.Text & "' where name='" & TextBox1.Text & "'", con)
cmd.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.ToString())
End Try
Response.Redirect("webform2.aspx")
End Sub
TextBox1.Text = Dt.Rows(ctr).Item("name")
TextBox2.Text = Dt.Rows(ctr).Item("dept")
TextBox3.Text = Dt.Rows(ctr).Item("salary")
Exit Function
End If
Next
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Function
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Function