Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/12/2008, 14:37
Avatar de ozzy999666
ozzy999666
 
Fecha de Ingreso: abril-2008
Mensajes: 13
Antigüedad: 16 años, 1 mes
Puntos: 0
Conexion SQL VB.Net

Necesito ayuda conun codigo, estoy intentando agregar registros, pero no estoy seguro de si la sentencia esta bien escrita, la pongo aca para ver si me hecha una manito.

Dim conexion As SqlConnection
Dim ingresos As String = "Insert into Empleados (Nombre, Apellido, Fech_Nac, Direccion, Telefono, Celular, DUI, NIT, Cargo, AFP, ISSS, Carnet) values (@txt_name, @txt_ape, @txt_fecha, @txt_dir, @txt_tel, @txt_cel, @txt_dui, @txt_nit, @txt_cargo, @txt_afp, @txt_isss, @txt_carnet)"
conexion = New SqlConnection("Data Source=FAMILIA-C086F4B\SQLEXPRESS;Initial Catalog=Proyecto;Integrated Security=True")
conexion.Open()
Dim mc As SqlCommand
mc = New SqlCommand(ingresos, conexion)
Try
mc.executenonquery()
MessageBox.Show("Registros agregados")
Catch ex As Exception
MessageBox.Show("Error al intentar agregar los registros")
End Try
conexion.Close()


Gracias por la Ayuda