Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click Try If IsPostBack() Then Dim objConn As New SqlConnection(WebConfigurationManager.ConnectionStrings("cnxCurso").ConnectionString) Dim sSQL, Resul As String sSQL = "Insert into dbo.actor (dpi, nombre, comunidad, fecha, genero, usuario) values ('" & txtdpi.Text & "', '" & txtactor.Text & "', '" & txtcomunidad.Text & "', '" & txtfecha.Text & "', '" & genero.Text & "', '" & txtusuario.Text & "')" Dim objCmd As New SqlCommand(sSQL, objConn) objConn.Open() Resul = objCmd.ExecuteNonQuery If Resul Then 'MsgBox("Se ha agregado correctamente el registro") respuesta.Visible = True respuesta.Text = "Registro agregado" Response.Redirect("mantenimiento.aspx", True) objConn.Close() Else 'MessageBox.Show("No se agregado correctamente el registro") respuesta.Visible = True respuesta.Text = "Registro no agregado" End If End If Catch ex As SqlException End Try respuesta.Text = "Registro agregado" End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)