Discussion:
Database SQL statement
Jim Wagner
2017-09-20 19:57:58 UTC
Permalink
Greetings -

Database = MySQL

I have been through the LR and the Tutorials and now the Users Guide (Framework > Databases) and I am stumped. I remember that something special was needed for this on the RBDatabase but I cannot recall what.

I want to have a WHERE statement to be defined by a program-generated variable, as in

Dim N as integer = (row ID obtained elsewhere)
Dim deleteSQL as string = “DELETE FROM Event WHERE ID = ’N'”

But that won’t work because N must be a number defined by the program and the previous expression will take N literally as a string.

I’ve also been though a fair amount of MySQL documentation and have yet to find anything that illuminates this. Its probably there, but just not yet found.

Can someone help?

Many Thanks
Jim

James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>







To unsubscribe, email ***@xojo.com
Jim Wagner
2017-09-20 20:39:15 UTC
Permalink
Slight error -

Database = SQLite

Jim

James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Subject: Database SQL statement
Date: September 20, 2017 at 12:57:58 PM PDT
Greetings -
Database = MySQL
I have been through the LR and the Tutorials and now the Users Guide (Framework > Databases) and I am stumped. I remember that something special was needed for this on the RBDatabase but I cannot recall what.
I want to have a WHERE statement to be defined by a program-generated variable, as in
Dim N as integer = (row ID obtained elsewhere)
Dim deleteSQL as string = “DELETE FROM Event WHERE ID = ’N'”
But that won’t work because N must be a number defined by the program and the previous expression will take N literally as a string.
I’ve also been though a fair amount of MySQL documentation and have yet to find anything that illuminates this. Its probably there, but just not yet found.
Can someone help?
Many Thanks
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
To unsubscribe, email ***@xojo.com
beejorge
2017-09-20 20:44:26 UTC
Permalink
Hi Jim
Try With N in double quotes = "N"
Just my 2cBest regards Beent 
-------- Oprindelig besked --------Fra: Jim Wagner <***@comcast.net> Dato: 20/09/2017 21.57 (GMT+01:00) Til: Nug <***@lists.xojo.com> Emne: Database SQL statement
Greetings -
Database = MySQL
I have been through the LR and the Tutorials and now the Users Guide (Framework > Databases) and I am stumped. I remember that something special was needed for this on the RBDatabase but I cannot recall what.
I want to have a WHERE statement to be defined by a program-generated variable, as in
Dim N as integer = (row ID obtained elsewhere)Dim deleteSQL as string  = “DELETE FROM Event WHERE ID =  ’N'”
But that won’t work because N must be a number defined by the program and the previous expression will take N literally as a string. 
I’ve also been though a fair amount of MySQL documentation and have yet to find anything that illuminates this. Its probably there, but just not yet found. 
Can someone help?
Many ThanksJim

James WagnerOregon Research Electronicshttp://www.orelectronics.net








To unsubscribe, email us here.


To unsubscribe, email ***@xojo.com
Jim Wagner
2017-09-20 22:43:07 UTC
Permalink
I found by experimenting that

“DELETE FROM Event WHERE ID = “ + str(N)

does what I need.

Thanks
Jim

James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by beejorge
Hi Jim
Try With N in double quotes = "N"
Just my 2c
Best regards
Beent
-------- Oprindelig besked --------
Dato: 20/09/2017 21.57 (GMT+01:00)
Emne: Database SQL statement
Greetings -
Database = MySQL
I have been through the LR and the Tutorials and now the Users Guide (Framework > Databases) and I am stumped. I remember that something special was needed for this on the RBDatabase but I cannot recall what.
I want to have a WHERE statement to be defined by a program-generated variable, as in
Dim N as integer = (row ID obtained elsewhere)
Dim deleteSQL as string = “DELETE FROM Event WHERE ID = ’N'”
But that won’t work because N must be a number defined by the program and the previous expression will take N literally as a string.
I’ve also been though a fair amount of MySQL documentation and have yet to find anything that illuminates this. Its probably there, but just not yet found.
Can someone help?
Many Thanks
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
To unsubscribe, email ***@xojo.com

Keith DeLong
2017-09-20 20:46:44 UTC
Permalink
Hi Jim, I think this may be what you’re looking for:

Dim N as integer = (row ID obtained elsewhere)
Dim deleteSQL as string = “DELETE FROM Event WHERE ID = “ + Str(N)

In SqlLite only strings need to be encased in quotes

Keith DeLong
Post by Jim Wagner
Greetings -
Database = MySQL
I have been through the LR and the Tutorials and now the Users Guide (Framework > Databases) and I am stumped. I remember that something special was needed for this on the RBDatabase but I cannot recall what.
I want to have a WHERE statement to be defined by a program-generated variable, as in
Dim N as integer = (row ID obtained elsewhere)
Dim deleteSQL as string = “DELETE FROM Event WHERE ID = ’N'”
But that won’t work because N must be a number defined by the program and the previous expression will take N literally as a string.
I’ve also been though a fair amount of MySQL documentation and have yet to find anything that illuminates this. Its probably there, but just not yet found.
Can someone help?
Many Thanks
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
To unsubscribe, email ***@xojo.com
Jim Wagner
2017-09-20 21:20:28 UTC
Permalink
You are right - I tried it JUST before you responded. I got caught in memories of having to do something special in the previous incarnation.

Thanks for responding,

Jim

James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jim Wagner
Dim N as integer = (row ID obtained elsewhere)
Dim deleteSQL as string = “DELETE FROM Event WHERE ID = “ + Str(N)
In SqlLite only strings need to be encased in quotes
Keith DeLong
Post by Jim Wagner
Greetings -
Database = MySQL
I have been through the LR and the Tutorials and now the Users Guide (Framework > Databases) and I am stumped. I remember that something special was needed for this on the RBDatabase but I cannot recall what.
I want to have a WHERE statement to be defined by a program-generated variable, as in
Dim N as integer = (row ID obtained elsewhere)
Dim deleteSQL as string = “DELETE FROM Event WHERE ID = ’N'”
But that won’t work because N must be a number defined by the program and the previous expression will take N literally as a string.
I’ve also been though a fair amount of MySQL documentation and have yet to find anything that illuminates this. Its probably there, but just not yet found.
Can someone help?
Many Thanks
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
To unsubscribe, email ***@xojo.com
Continue reading on narkive:
Loading...