Problema con SQL URGENTE
Tengo problemas con una SQL que estoy haciendo,
el problema es que me modifica la informacion de toda la tabla
y no solo del registro que yo quiero, ademas le agregue la opcion WHERE
para que solo me modifique es registro pero no lo hace,
alguien me podria ayudar, aqui envio la SQL , de ante mano muchas gracias
Sql = "UPDATE Secreduc SET Secreduc.Nombres = '" & Nombres.Text & "',"
Sql = Sql & "Secreduc.Apellidos = '" & Apellidos.Text & "',"
Sql = Sql & "Secreduc.Departamento = '" & Depto.Text & "',"
Sql = Sql & "Secreduc.Seccion = '" & Seccion.Text & "',"
Sql = Sql & "Secreduc.Tecnico = '" & Tecnicos.Text & "',"
Sql = Sql & "Secreduc.Marca = '" & Marca.Text & "',"
Sql = Sql & "Secreduc.Modelo = '" & Modelo.Text & "',"
Sql = Sql & "Secreduc.Cpu = '" & Cpu.Text & "',"
Sql = Sql & "Secreduc.Ram = '" & Ram.Text & "',"
Sql = Sql & "Secreduc.Hdd = '" & Hdd.Text & "',"
Sql = Sql & "Secreduc.Computername = '" & ComputerName.Text & "',"
Sql = Sql & "Secreduc.SistOperativo = '" & Sistema.Text & "',"
Sql = Sql & "Secreduc.office = '" & Office.Text & "',"
Sql = Sql & "Secreduc.Rut = '" & Rut.Text & "',"
Sql = Sql & "Secreduc.FechaServicio = '" & CDate(FecSolicitud.Text) & "',"
Sql = Sql & "Secreduc.SopTerreno1 = '" & SopTerre & "',"
Sql = Sql & "Secreduc.SopSistema1 = '" & SopSis & "',"
Sql = Sql & "Secreduc.SopUsuario1 = '" & SopUsu & "',"
Sql = Sql & "Secreduc.InfoServidor1 = '" & InfoSer & "',"
Sql = Sql & "Secreduc.InfoIntranet1 = '" & InfoIntra & "',"
Sql = Sql & "Secreduc.RepSoftware1 = '" & RepSoft & "',"
Sql = Sql & "Secreduc.RepHardware1 = '" & RepHard & "',"
Sql = Sql & "Secreduc.Conectividad1 = '" & Conec & "',"
Sql = Sql & "Secreduc.Telefonica1 = '" & Tele & "',"
Sql = Sql & "Secreduc.Remota1 = '" & Remo & "',"
Sql = Sql & "Secreduc.Observaciones = '" & Observaciones.Text & "',"
Sql = Sql & "Secreduc.Terreno1 = '" & Terre & ""
Sql = Sql & " Where Secreduc.Nservicio = " & Val(NServicio.Text) & "'"
el problema es que me modifica la informacion de toda la tabla
y no solo del registro que yo quiero, ademas le agregue la opcion WHERE
para que solo me modifique es registro pero no lo hace,
alguien me podria ayudar, aqui envio la SQL , de ante mano muchas gracias
Sql = "UPDATE Secreduc SET Secreduc.Nombres = '" & Nombres.Text & "',"
Sql = Sql & "Secreduc.Apellidos = '" & Apellidos.Text & "',"
Sql = Sql & "Secreduc.Departamento = '" & Depto.Text & "',"
Sql = Sql & "Secreduc.Seccion = '" & Seccion.Text & "',"
Sql = Sql & "Secreduc.Tecnico = '" & Tecnicos.Text & "',"
Sql = Sql & "Secreduc.Marca = '" & Marca.Text & "',"
Sql = Sql & "Secreduc.Modelo = '" & Modelo.Text & "',"
Sql = Sql & "Secreduc.Cpu = '" & Cpu.Text & "',"
Sql = Sql & "Secreduc.Ram = '" & Ram.Text & "',"
Sql = Sql & "Secreduc.Hdd = '" & Hdd.Text & "',"
Sql = Sql & "Secreduc.Computername = '" & ComputerName.Text & "',"
Sql = Sql & "Secreduc.SistOperativo = '" & Sistema.Text & "',"
Sql = Sql & "Secreduc.office = '" & Office.Text & "',"
Sql = Sql & "Secreduc.Rut = '" & Rut.Text & "',"
Sql = Sql & "Secreduc.FechaServicio = '" & CDate(FecSolicitud.Text) & "',"
Sql = Sql & "Secreduc.SopTerreno1 = '" & SopTerre & "',"
Sql = Sql & "Secreduc.SopSistema1 = '" & SopSis & "',"
Sql = Sql & "Secreduc.SopUsuario1 = '" & SopUsu & "',"
Sql = Sql & "Secreduc.InfoServidor1 = '" & InfoSer & "',"
Sql = Sql & "Secreduc.InfoIntranet1 = '" & InfoIntra & "',"
Sql = Sql & "Secreduc.RepSoftware1 = '" & RepSoft & "',"
Sql = Sql & "Secreduc.RepHardware1 = '" & RepHard & "',"
Sql = Sql & "Secreduc.Conectividad1 = '" & Conec & "',"
Sql = Sql & "Secreduc.Telefonica1 = '" & Tele & "',"
Sql = Sql & "Secreduc.Remota1 = '" & Remo & "',"
Sql = Sql & "Secreduc.Observaciones = '" & Observaciones.Text & "',"
Sql = Sql & "Secreduc.Terreno1 = '" & Terre & ""
Sql = Sql & " Where Secreduc.Nservicio = " & Val(NServicio.Text) & "'"
Detecto dos errores:
1. En la línea
Sql = Sql & "Secreduc.Terreno1 = '" & Terre & ""
te faltaría una ', entonces te quedaría
Sql = Sql & "Secreduc.Terreno1 = '" & Terre & "'"
2. En la línea
Sql = Sql & " Where Secreduc.Nservicio = " & Val(NServicio.Text) & "'"
te faltaría una '
Sql = Sql & " Where Secreduc.Nservicio = '" & Val(NServicio.Text) & "'"
además, tendrías que revisar si el campo Nservicio es numérico, entonces no deberías colocar el resultado entre ' y '; pero si el valor es texto, no entiendo por qué utilizas el Val(NServicio.Text)
Espero que te sirvan las soluciones que te doy, de todas maneras me haces saber si te funcionó o no.
1. En la línea
Sql = Sql & "Secreduc.Terreno1 = '" & Terre & ""
te faltaría una ', entonces te quedaría
Sql = Sql & "Secreduc.Terreno1 = '" & Terre & "'"
2. En la línea
Sql = Sql & " Where Secreduc.Nservicio = " & Val(NServicio.Text) & "'"
te faltaría una '
Sql = Sql & " Where Secreduc.Nservicio = '" & Val(NServicio.Text) & "'"
además, tendrías que revisar si el campo Nservicio es numérico, entonces no deberías colocar el resultado entre ' y '; pero si el valor es texto, no entiendo por qué utilizas el Val(NServicio.Text)
Espero que te sirvan las soluciones que te doy, de todas maneras me haces saber si te funcionó o no.