[Gambas-user] mySQL stuff

neil lewis neil at ...233...
Sun Jul 3 17:43:46 CEST 2005


H Simon,

I've doing the same sort of things, it seems. I'd guess from your post 
that the "stuff not working" is being able to edit records - the same 
problem I was having.
Nigel Gerrard came to my rescue with the correct syntax for creating a 
query for read/write access. His reply enabled me to get this working in 
seconds, but I couldn't really understand what was going on, so I asked 
for a little more explanation, which he was also kind enough to provide.

My original question and the first answer should be in the recent list 
history.
I reproduce the follow-up below. If you want any further help on this, 
I'd be happy to offer the benefit of my (very limited) experience!

Neil Lewis

-------------------

> > Yes, that did the trick. I have to say though that I don't really
> > understand the syntax there. Could you explain what it's actually 
> saying?
> >
>
> The Edit function for a table actual translates into a simple SQL 
> statement; the query part is basically the "where" clause which is 
> intrinsically used with the rest of the query parameter. the query 
> parameter contains the field value to be checked with an optional 
> place holder (&1...&9 etc.). The place holders will be replaced by the 
> arguments in the rest of the statement.
>
> So with:
>
> query = " id = &1"
>
> rwResult = hConnection.Edit(table, query, roResult["id"])
>
> translates to "SELECT * FROM table WHERE id = roResult["id"]
>
> You could also have
>
> query = "id = &1 AND age = &2"
>
> rwResult = hConnection.Edit(table, query, roResult["id"], 26)
>
------------------------------------

Simon Robert wrote:

> Hi there
>
> I'm starting to find my way around gambas and OOP, also attempting to 
> get to grips with mySQL. Does any good person out there have a nice 
> simple project that demos all the stuff you'd want to do with gambas 
> and mySQL? Stuff like finding things, moving to the next record, 
> creating new records, counting the number of records in a table, 
> updating a record etc etc.... I've based what I'm doing on the 
> database example and can create new records, but am finding some of 
> the other stuff not working.
>
> If someone would like to give me some code that has examples of these 
> things, or could direct me at an idiots guide, (dummy is too 
> advanced), I'd be really gratefull.
>
> Thanks
>   Simon
>





More information about the User mailing list