Well, if you create your table with the id set as an INTEGER PRIMARY KEY,
then it will auto-increment for you. You won''t need to do it yourself.
All
you have to do is insert the data. An example would be:
db.execute("INSERT INTO clients (name,address,phone,email,website)
VALUES(?,?,?,?,?);", at name.get_value(), at address.get_value(), at
phone.get_value(), at email.get_value, at website.get_value())
@name, @address, @phone, @email and @website would be TextCtrl''s that
hold
the data that the user inputed. Then to get them back, you simply do:
db.execute("SELECT * FROM clients;") Which returns all rows in the
table.
Or you can narrow down the entries, by doing db.execute("SELECT * FROM
clients WHERE name=''Mario Steele'';") Which will return
any matches where
the name column of the row has "Mario Steele"
On Sat, May 3, 2008 at 3:13 PM, Gerard Rakoczy <lists at ruby-forum.com>
wrote:
> hi,
> i have a small form of textfields and i need to add these informations
> to a table in sqlite3 database. but i dont know how to do it. i mean
> that its small address book program. and ''id'' from
''clients'' table has
> to increments. i open database with : db =
Database.open("data.db"), but
> then i dont know what to do...
>
> anyone can help?
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> wxruby-users mailing list
> wxruby-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wxruby-users
>
--
Mario Steele
http://www.trilake.net
http://www.ruby-im.net
http://rubyforge.org/projects/wxruby/
http://rubyforge.org/projects/wxride/
http://rubyforge.org/projects/vwmc/
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/wxruby-users/attachments/20080503/724395a4/attachment.html>