See my comments below.
On Mon, 2005-08-01 at 21:06 +0200, Peter Berkel wrote:
> Hallo,
>
> I am not an expert in programming and I try make a frontend
> for sqlite using tcl/tk. See example code below.
>
> I have the following problem. I try to entry data which I want to insert in a
> sqlite database. The Values of the textvariables a b and c in the entry
> widget are set in the insert statement.
>
> What do I wrong and how can I solve the problem so that I can use the entry
> widget to insert, modify and delete dat from a sqlite database.
>
> Thanks for helping me out.
>
> Peter Berkel
>
>
> load tclsqlite3 sqlite3
> sqlite3 db test.db
> db eval {
> CREATE TABLE t1(a,b,c);
> }
>
> set a 0
> set b 0
> set c 0
>
>
> entry .entry1 -width 20 -textvariable a
> entry .entry2 -width 20 -textvariable b
> entry .entry3 -width 20 -textvariable c
>
>
> db eval {insert into t1 values ($a,$b,$c)}
The statement above does the insert, but it does
so immediately, not in response to the button
press. To run this command in response to the
button pressed, do this:
button .button1 -text execute -commmand {
db eval {insert into t1 values($a,$b,$c)}
}
>
> button .button1 -text "execute"
>
> pack .entry1 .entry2 .entry3 .button1
>
> db close