ayuda con insert into sql - v.net
Publicado por arsone (2 intervenciones) el 01/04/2009 18:30:37
hola le s cuento estoy asiendo una aplicacion en visual.net y sql 2005 y tengo problemas con un inst into nose que problema pueda tener les mando el codigo
Public Class FormAdmin_Ingre
Public ConeccionBD As SqlConnection = Nothing
Public CadenaConeccionBD As String
Dim sqlCommand As SqlCommand = Nothing
Private Sub btn_IngresarAlumno_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_IngresarAlumno.Click
ConeccionBD = New SqlConnection
Try
ConeccionBD = New SqlConnection()
ConeccionBD.ConnectionString = "Data Source=MONTANADC;Initial Catalog=SRN;Integrated Security=True"
sqlCommand = New SqlCommand("INSERT INTO ALUMNO(RUT,NOMBRE,EDAD,F_NACIEMIENTO,NOMBRE_APODERADO,TELEFONO_ALUMNO,CURSO_ALUMNO) VALUES('txt_nombreAlumno','txt_runAlumno','fechaNacimientoAlumno','txt_edadAlumno','txt_nombreApoderado','txt_direccionAlumno',txt_telefonoalumno,txt_cursoAlumno)")
Me.ConeccionBD.Open()
sqlCommand.ExecuteNonQuery()
msgbox("se inseertado con exito",MsgBoxStyle.MsgBoxRight)
''Dim queryIngresar = "insert into alumnos values txt_runAlumno,txt_nombreAlumno,txt_edadAlumno, txt_direccionAlumno,fechanacimientoAlumno, txt_nombreApoderado,txt_fonoAlumno, txt_cursoAlumno"
Catch ex As Exception
'si se produce un error'
MsgBox("ERROR AL INSERTAR DATOS", MsgBoxStyle.Critical)
ConeccionBD.Close() 'Cerramos la Coneccion'
End 'cerramos el formulario'
End Try
End Sub
end class
Public Class FormAdmin_Ingre
Public ConeccionBD As SqlConnection = Nothing
Public CadenaConeccionBD As String
Dim sqlCommand As SqlCommand = Nothing
Private Sub btn_IngresarAlumno_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_IngresarAlumno.Click
ConeccionBD = New SqlConnection
Try
ConeccionBD = New SqlConnection()
ConeccionBD.ConnectionString = "Data Source=MONTANADC;Initial Catalog=SRN;Integrated Security=True"
sqlCommand = New SqlCommand("INSERT INTO ALUMNO(RUT,NOMBRE,EDAD,F_NACIEMIENTO,NOMBRE_APODERADO,TELEFONO_ALUMNO,CURSO_ALUMNO) VALUES('txt_nombreAlumno','txt_runAlumno','fechaNacimientoAlumno','txt_edadAlumno','txt_nombreApoderado','txt_direccionAlumno',txt_telefonoalumno,txt_cursoAlumno)")
Me.ConeccionBD.Open()
sqlCommand.ExecuteNonQuery()
msgbox("se inseertado con exito",MsgBoxStyle.MsgBoxRight)
''Dim queryIngresar = "insert into alumnos values txt_runAlumno,txt_nombreAlumno,txt_edadAlumno, txt_direccionAlumno,fechanacimientoAlumno, txt_nombreApoderado,txt_fonoAlumno, txt_cursoAlumno"
Catch ex As Exception
'si se produce un error'
MsgBox("ERROR AL INSERTAR DATOS", MsgBoxStyle.Critical)
ConeccionBD.Close() 'Cerramos la Coneccion'
End 'cerramos el formulario'
End Try
End Sub
end class
Valora esta pregunta


0