Hola a Todos
Necesito que alguien me ayude con esto. tengo que ingresar unos datos del cliente a una base y si les pongo los datos a mano en el insert lo hace perfecto pero si lo quiero hacer con variabnles no lo hace alguien me puede ayudar copio el codigo, seguro algo esta mal escrito o algo asi.

ahora deje solo los datos para la cedula para probar pero nada ...

def OnClickAceptar(self,event):

        dtcedula = self.TextoCedulaCli.GetValue()
        nombres = self.TextoNombresCli.GetValue()
        apellidos = self.TextoApellidosCli.GetValue()
        direccion = self.TextoDireccionCli.GetValue()
        email = self.TextoCorreo.GetValue()
        telefonocelular = self.TextoTelefonoCeluar.GetValue()
        telefonoparticular = self.TextoTelefonoParticular.GetValue()



        # Open database connection
db = MySQLdb.connect("localhost","root","miyaguiAdminaya2010","cambio")

        # prepare a cursor object using cursor() method
        cursor = db.cursor()

        # Prepare SQL query to INSERT a record into the database.

        print dtcedula
        sql = """INSERT INTO clientes(cedula) VALUES ('%s') % dtcedula"""


        try:
                 # Execute the SQL command
                 cursor.execute(sql)
                 # Commit your changes in the database
                 db.commit()
        except:
                 #Rollback in case there is any error
                 db.rollback()

                 # disconnect from server
                 db.close()

_______________________________________________
Python-es mailing list
Python-es@python.org
http://mail.python.org/mailman/listinfo/python-es
FAQ: http://python-es-faq.wikidot.com/

Responder a