Results 1 to 1 of 1
Hello to everybody !!!
Im playing with Tcl/Tk/MysqlTcl. Tcl is a scripting language, Tk provides widgets for creating interfaces and MysqlTcl, provide MySQL connectivity.
Im trying basic things with mysql ...
- 05-08-2008 #1Just Joined!
- Join Date
- Oct 2007
- Location
- Mexico
- Posts
- 65
Tcl/TK/MysqlTcl - Question on parameter parsing
Hello to everybody !!!
Im playing with Tcl/Tk/MysqlTcl. Tcl is a scripting language, Tk provides widgets for creating interfaces and MysqlTcl, provide MySQL connectivity.
Im trying basic things with mysql connections and database queries for, next, try to do Delphi/Jave like interfaces.
I have a simple form where i ask for database name, user, password, table and a column to query, a simple select to test, these data are passed to a function/procedure for the connection, but the table and column variables dont pass the query, especifically the table name, an error tell that table doesn exist...
but exists
Table 'mydatabase.$tb' doesn't exist
maybe the value of $tb is not substituted, but why the others are???
this is the code:
the problem is in this part:Code:#!/usr/local/bin/wish package require mysqltcl wm title . Formulario wm minsize . 320 240 wm resizable . no no frame .frmSup frame .frmMed frame .frmInf label .lblBase -text "Base de Datos:" entry .txtBase -textvar base label .lblUsuario -text Usuario: entry .txtUsuario -textvar usuario label .lblPass -text Password: entry .txtPass -textvar pass label .lblTabla -text Tabla: entry .txtTabla -textvar tabla label .lblCol -text Columna: entry .txtCol -textvar columna button .btnAceptar -text Aceptar -command { Consulta [.txtBase get] [.txtUsuario get] [.txtPass get] [.txtTabla get] [.txtCol get] } button .btnLimpiar -text Limpiar -command { set base ""; set usuario ""; set pass ""; set pass ""; set tabla ""; set columna ""} button .btnCerrar -text Cerrar -command { exit } pack .frmSup -fill x -side left pack .lblBase .txtBase .lblUsuario .txtUsuario .lblPass .txtPass -padx 2 pack .frmMed -fill x -side left pack .lblTabla .txtTabla .lblCol .txtCol -padx 2 pack .frmInf -fill x -side left pack .btnCerrar .btnLimpiar .btnAceptar -side right -padx 2 proc Consulta { bd usr pwd tb col } { puts "Base: $bd User: $usr Pass: $pwd Tabla: $tb Columna: $col" set con [mysqlconnect -user $usr -db $bd -password $pwd] mysqluse $con mysql foreach res [mysqlsel $con {select $col from $tb} -flatlist] { puts $res } mysqlclose $con }
foreach res [mysqlsel $con {select $col from $tb} -flatlist]
i first tested the procedure Consulta (Query on english) alone and works, well.. writting the names directly.
i dont know what else try.
i'll appreciate any ideas that could give me
Thanks to everybody
See you


Reply With Quote