TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:10396] kmysql



On Mon, 22 Nov 1999, Bob Tanner wrote:

> kmysql lets you query, but does not allow you to add rows to a table or alter
> rows to a table.
> 
> Amy I missing something ?


From the kmysql online help...

3.3. A simple example

Let's say you have a very simple table named Friends, with two fields
named name and city containig text (VARCHAR(127) for example). Of
course, you can enter rows in it by hand,entering a INSERT INTO
Friends VALUES... query. But let's see how this could be done via a
form.

Right-click on the base containing our table and select New form. Give
it a name like New friend. Then add two text fields named Name and
City. Then enter the following query:

INSERT INTO Friends (name, city) VALUES ('$Name$', '$City$')

This will add a new entry in your table using the data collected in
the form. Note that if you expect the form's user to enter text in a
field you must supply quotes by yourself in the query, otherwise you
will get a syntax error. Now save your form and try it!

We will now create a form to find users within your table. Let's
create a new form named Look for friend and containing the same two
fields Name and City. Then enter the following query:

SELECT * FROM Friends where ('$Name$'='' or name='$Name$') and
('$City$'='' or city='$City$')

Note that this query lets the form's user to left one or more fields
blanks using '$Field$'='' in a OR statement.