Update mySQL-Database

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
inselfan
Posts: 42
Joined: Fri Nov 10, 2006 11:33 am
Location: Menorca, Spain

Update mySQL-Database

Post by inselfan » Sun Dec 10, 2006 2:05 pm

Helo ,

Since hours I try to find my folkd by using:

put "UPDATE Customers SET Foto_pfad = " & Fotopfad & " where kndnr =" & customernumber into SQL_Befehl

executeSQL (DB_ID, SQL_Befehl)

Any idea out there?

best regards and thank you

Horst

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sun Dec 10, 2006 4:02 pm

Horst, have you tried the sql syntax without spaces before and after the equal sign?

put "UPDATE Customers SET Foto_pfad=" & Fotopfad & " where kndnr=" & customernumber

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

inselfan
Posts: 42
Joined: Fri Nov 10, 2006 11:33 am
Location: Menorca, Spain

Post by inselfan » Sun Dec 10, 2006 4:26 pm

Hi Mark,

Thanks for answering :-))

Yes, just tried, the result is the same error:
Handler: can't find handler
button ID 1615
revdb_execute (DB_ID, SQL_Befehl)
revdb_execute

Now, To make it realy easy I tried:

put "UPDATE knddaten SET Foto_pfad='Test' where kndnr=1318" into SQL_Befehl

Same result, same error-message as abowe.
I know, the SQL Syntax is correct, tryed directly on the database.

any idea?

best regards

Horst

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sun Dec 10, 2006 4:46 pm

I think you should post your entire script. Do you know that revdb_execute is not a command but a function?

get revdb_execute(DB_ID,SQL_Befehl)

shouldn't return an error. Do other SQL-related commands and functions work correctly?

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

inselfan
Posts: 42
Joined: Fri Nov 10, 2006 11:33 am
Location: Menorca, Spain

Post by inselfan » Sun Dec 10, 2006 7:03 pm

Hi Mark,

Thanks again for answering,

It is frustrating. I'm a runRev newby and tray to work with RunRev and mySQL.

The original Idea was just to save a picture into a file which didn't work

"UPDATE knddaten SET Foto_image = "& the imagedata of image "Foto_Image" & " where kndnr =" & kundennummer into SQL_Befehl
revexecuteSQL (DB_ID, SQL_Befehl)

the Foto_image is defined as Bin

So, step by step and hours later I just want to write a word like Test into a field in the database, which also don't work

put "UPDATE knddaten SET Foto_pfad='Test' where kndnr=1318" into SQL_Befehl

revexecuteSQL (DB_ID, SQL_Befehl)
the foto_Pfad is defined as text in SQL

I think in the near future I will give up and go to Filemaster or Realbasic. To understand RunRev with this lousy description costs Hours of my time I coulds use better, is frustrating and you always feel like a stupid looser. The only hope is the board but you have to be lucky, to find a helpfull hand like you are.

best regards and thanks

Horst

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sun Dec 10, 2006 7:09 pm

Horst,

You didn't answer my questions, which I really need an answer to in order to help you. Do other SQL-related commands in Rev work fine for you? Do you realise that revdb_execute is a function and not a command? I think you do something wrong and, as I said, you should post your entire script.

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

inselfan
Posts: 42
Joined: Fri Nov 10, 2006 11:33 am
Location: Menorca, Spain

Post by inselfan » Sun Dec 10, 2006 7:56 pm

Hi Mark,

I'm sorry that I didn't answer correct, but, as you see, that's the stack:

on mouseup
GLOBAL DB_ID, Kundennummer, Rec_ID

put fld "kndnr" into kundennummer

put "UPDATE knddaten SET Foto_pfad='Test' where kndnr=1318" into SQL_Befehl

revexecuteSQL (DB_ID, SQL_Befehl)
end mouseup

Where is my fold?

best regards

Horst

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sun Dec 10, 2006 8:13 pm

Horst,

OK, you changed revdb_exe into revExecuteSQL. That's fine, the latter is a command while the former is a function. You added brackets to the revExecuteSQL command. Functions need brackets around paremeters, but if you put brackets around the parameters of a command, Rev gets confused.

When using a command, you can do this:

doSomeCommand (parameter1),(parameter2)

but not

doSomeCommand (parameter1,parameter2)

This is a general rule in Revolution and has nothing to do with the built-in SQL and other database commands.

Now, your script should look like this:

on mouseup
global DB_ID, Kundennummer, Rec_ID
put fld "kndnr" into kundennummer
put "UPDATE knddaten SET Foto_pfad='Test' WHERE kndnr=1318" into SQL_Befehl
revexecuteSQL DB_ID,SQL_Befehl
put the result
end mouseup

I am sure this will work fine. I have added a line that puts the result into the message box. You might want to change this line and show an error message if item 1 of the result is revdberr.

Best regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

inselfan
Posts: 42
Joined: Fri Nov 10, 2006 11:33 am
Location: Menorca, Spain

Post by inselfan » Sun Dec 10, 2006 9:03 pm

Hi Marc,

to make a long long story short, lets continue with one of your last sentences:
" I am sure this will work fine"

That's what it does :lol:

I've spent a long and frustrating day, you gave me a few minutes and...
... it's done!

Puhhh, 1 day for one line... When do I possibly have a chance to fix my aplication? In 150 years? Might be :-)

Could you tell me a documentation about Transcript, that realy works?

Hey Marc, people like you are like sun in the grey winter Thanks a lot

Horst

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sun Dec 10, 2006 11:40 pm

Hello Horst,

I'm always glad to help. Little mistakes like these can happen to any beginning Revolution programmer. I know it is frustrating in the beginning, but once you know it, the problem is solved for once and forever.

Actually, the only really good documentation that I know of is for HyperCard. If you find a book for HyperCard, I'd buy and read it. For example, the Complete HyperCard Handbook contains very useful parts:

http://books.iuniverse.com/viewgiftoc.a ... 427&page=5

particularly chapters 21, 22, 24, 28, 32 and 35.

After reading this, you could have alook at the scripting conference stacks at

http://support.runrev.com/scriptingconferences/

Among other things, this will show you that there are also important differences between Revolution and HyperCard.

You should also look in Revolution Online, where you will mostly find very simple stacks from which you can learn how things work. Rev Online can be found in the Development menu of the Revolution IDE.

You can also use gmane to search the Rev Mailing list. It was possible to do this with Google, but this doesn't work well currently.

http://news.gmane.org/gmane.comp.ide.revolution.user

Maybe, others can add more resources.

Best regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply

Return to “Databases”