How to define a field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
How to define a field
Holá everybody,
I do not find out, how to get a field from a MySQL Database. With:
put "SELECT * from table where Masc_name=" & q (tPath) into SQLBefehl
put revdb_query (DB_ID,SQLBefehl)into temp1
With this, I can select the right Table and the right record, but how to put one of the fields of this record into a local defined Variable??? Please, if you have an answer, let me know.
best regards and thank you
Inselfan
I do not find out, how to get a field from a MySQL Database. With:
put "SELECT * from table where Masc_name=" & q (tPath) into SQLBefehl
put revdb_query (DB_ID,SQLBefehl)into temp1
With this, I can select the right Table and the right record, but how to put one of the fields of this record into a local defined Variable??? Please, if you have an answer, let me know.
best regards and thank you
Inselfan
Hi Inselfan,
You can do this using the revdb_querylist function.
Try something like this:
This should put the result of the select query into the variable tQueryResult, with each column separated by tab and each line separated by return.
Hope this helps
Regards
Oliver
You can do this using the revdb_querylist function.
Try something like this:
Code: Select all
put revdb_querylist(tab, return, DB_ID, SQLBefehl) into tQueryResult
Hope this helps
Regards
Oliver
Oliver Kenyon
Software Developer
Runtime Revolution
Software Developer
Runtime Revolution
Hi Inselfan,
I think the best way to do this is to use the SQL query to return
only the fields that you are interested in, otherwise your program
will be doing more work than it needs to. I think the syntax is something
like "SELECT field1, field2 FROM table WHERE ..."
Alternatively, you can set the itemDelimiter to tab in Revolution and write
a function that extracts the fields you want.
Regards
Oliver
I think the best way to do this is to use the SQL query to return
only the fields that you are interested in, otherwise your program
will be doing more work than it needs to. I think the syntax is something
like "SELECT field1, field2 FROM table WHERE ..."
Alternatively, you can set the itemDelimiter to tab in Revolution and write
a function that extracts the fields you want.
Regards
Oliver
Oliver Kenyon
Software Developer
Runtime Revolution
Software Developer
Runtime Revolution
Hi Oliver,
Thanks and you tell me something I also figured out
But THERE is my handicap. If I write:
put "select........." into Variable then (and I think now you smile) I find exact select......... in my variable. Which looks nice but doesn't make me happy
so, PLEASE, what is the right word instead of PUT?
a beginning user called
Inselfan
Thanks and you tell me something I also figured out
But THERE is my handicap. If I write:
put "select........." into Variable then (and I think now you smile) I find exact select......... in my variable. Which looks nice but doesn't make me happy
so, PLEASE, what is the right word instead of PUT?
a beginning user called
Inselfan
-
- Posts: 13
- Joined: Sun Dec 17, 2006 12:30 pm
I think what your asking for is something like this:
Hope I have understood the question and this helps somewhat.
Code: Select all
put revQueryDatabase(dbid, sql) into results_set
if results_set is not an integer then
-- query failed
if the number of items in results_set is 2 then
-- results is probably revdberr,blah
put item 2 of results_set into results_set
end if
warning "Query failed:" && line 1 of results_set
exit mouseUp
end if
if revNumberOfRecords(results_set) = 0 then
warning "No records found"
exit mouseUp
end if
answer "Field foo =" && revDatabaseColumnNamed(results_set, "foo")
answer "Field bar =" && revDatabaseColumnNamed(results_set, "bar")