
01/11/2011, 08:53
|
| | Fecha de Ingreso: octubre-2011 Ubicación: COLOMBIA, Medellín
Mensajes: 42
Antigüedad: 13 años, 4 meses Puntos: 0 | |
Respuesta: Version de Visual Studio mas utilizada hola me pueden ayudar soy muy novata en programacion y estoy creando una base de datos es visual basic pero me esta saliendo un error en varias tablas: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 en una de las tablas debo de concatenar los registros que son clave primaria1, clave primaria 2 que al mismo tiempo es foránea ya que hablo de la tabla subtipos y el tercer dato que es un nombre e intentado con el lamperson y las comillas de muchas formas y no lo he logrado
me podrian explicar como solucionarlo.
muchas gracias
este es una muestra de lo que tengo:
Private Sub cmdguardar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdguardar.Click
Dim cs As Integer
Dim ct As Integer
Dim nom As String
Dim sql As String
If txtcsubtipo.Text.Length = 0 Then
MessageBox.Show("codigo no valido", "ERROR")
txtcsubtipo.Focus()
Exit Sub
End If
If xopcion = 1 Then
Dim xcantidad As Long = -1
miconexion = New MySqlConnection("server=localhost;user=root;passwo rd=111;database=prueba009")
miconexion.Open()
micomando = New MySqlCommand("select count(*)from subtprod where codsubtp=" & txtcsubtipo.Text & ";", miconexion)
xcantidad = micomando.ExecuteScalar
miconexion.Close()
If xcantidad > 0 Then
MessageBox.Show("codigo digitado esta repetido", "ERROR")
txtcsubtipo.Focus()
Exit Sub
End If
End If
If txtctipo.Text.Length = 0 Then
MessageBox.Show("descripcion no valida", "ERROR")
txtctipo.Focus()
Exit Sub
ElseIf txtnombre.Text.Length = 0 Then
MessageBox.Show("nombre no valido", "ERROR")
txtnombre.Focus()
Exit Sub
End If
cs = Integer.Parse(txtcsubtipo.Text)
ct = Integer.Parse(txtctipo.Text)
nom = txtnombre.Text
If xopcion = 1 Then
sql = cs & ", " & ct & " ,'" & nom & "',"
miconexion = New MySqlConnection("server=localhost;user=root;passwo rd=111;database=prueba009")
miconexion.Open()
micomando = New MySqlCommand("insert into subtprod values(" & sql & ");", miconexion)
micomando.ExecuteNonQuery()
miconexion.Close()
MessageBox.Show("Registro almacenado con exito", "observacion")
ElseIf xopcion = 2 Then
sql = "update subtprod set nomstp='" & nom & "' and codt= & ct & where codsubtp = " & cs & " ;"
miconexion = New MySqlConnection("server=localhost;user=root;passwo rd=111;database=prueba009")
miconexion.Open()
micomando = New MySqlCommand(sql, miconexion)
micomando.ExecuteNonQuery()
miconexion.Close()
MessageBox.Show("registro Actualizado con exito", "Observacion")
End If
activar(False)
txtcsubtipo.Clear()
txtctipo.Clear()
txtnombre.Clear()
cmdagregar.Enabled = True
cmdguardar.Enabled = False
cmdborrar.Enabled = True
cmdbuscar.Enabled = True
cmdsalir.Enabled = True
cmdeditar.Enabled = True
cmdmayre.Enabled = True
cmdmenre.Enabled = True
cmdsig.Enabled = True
cmdant.Enabled = True
cmddeshace.Enabled = True
End Sub |