|
lucas Beginner
Joined: 01 Oct 2008 Posts: 16
|
Posted: Mon Jun 22, 2009 1:56 pm
How to use database in 721? |
so,
How to use database in 721?
I wirte simple code to query some value, but it does not work!
#DBLOAD quest
#sh %query(&key=@digits_1, value)
#DBCLOSE quest
quest is the db name created in the menu windows->database.
key and value are fields. |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon Jun 22, 2009 5:58 pm |
Couple questions? Is your database successfully loaded? Is the database populated? Remember that you need to have the database window open.
Also the %query command doesn't expand variables so you have to do something like so.
Code: |
#sh %query( (%concat( "&key=", @digits_1)), value) |
Finally remember ' value' in this example represents the particular database view you want to pull the information from. |
|
_________________ Asati di tempari! |
|
|
|
lucas Beginner
Joined: 01 Oct 2008 Posts: 16
|
Posted: Tue Jun 23, 2009 8:35 am |
I have my database window open.
then use your code,
the result is
0qu|1qu|2qu|3qu
what is wrong with it? |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue Jun 23, 2009 2:54 pm |
Those are the results of your query i.e. the the ids of the rows (in the quest databaste) that match your digits_1 variable. I'm not sure what you database structure is like so I don't know what other fields are in it. What were you expecting to see?
|
|
_________________ Asati di tempari! |
|
|
|
lucas Beginner
Joined: 01 Oct 2008 Posts: 16
|
Posted: Tue Jun 23, 2009 4:35 pm |
hi
the code does work.
#var ttemp
#DBLOAD quest721
#sh %query( (&key=qwe), ALL)
ttemp=%db( %query( (&key=qwe), ALL), key)
#sh @ttemp
#sh in query.....
#DBCLOSE quest721
it prints below:
3qu
qwe
in query.....
thanks Tech!!!
You does inspire me! |
|
|
|
lucas Beginner
Joined: 01 Oct 2008 Posts: 16
|
Posted: Tue Jun 23, 2009 5:10 pm |
so,
/*most important thing */
Remember that you need to have the database window open. |
|
|
|
|
|