Page 1 of 1
revDatabaseColumnNames: revdberr,syntax error"
Posted: Thu Mar 10, 2016 11:26 am
by francof
Hi all,
right from the dictionary:
get revDatabaseColumnNames(tConnectionId, "myTable")
I tried this
Code: Select all
get revDatabaseColumnNames(connID, "tcurtab")
connID have a valid connection number
tcurtab contain a valid table name
and also in this line:
Code: Select all
put revDatabaseColumnNames(connID, curtab ) into titoli
tried without double quotes
I got error: " card "Data": execution error at line n/a (External handler: exception) near "revdberr,syntax error" "
where I wrong?
best
franco
Re: revDatabaseColumnNames: revdberr,syntax error"
Posted: Thu Mar 10, 2016 12:17 pm
by Simon
Hi Franco,
Is connID a global variable?
My first guess.
Simon
Re: revDatabaseColumnNames: revdberr,syntax error"
Posted: Thu Mar 10, 2016 5:17 pm
by francof
ciao Simon,
connID is a custom property of the stack, and a temp variable also:
Code: Select all
...
put the connID of this stack into connID
if connID is not empty then
#recuperiamo le colonne
--get revDatabaseColumnNames(connID, "curtab")
put revDatabaseColumnNames(connID, curtab ) into titoli
...
I am testing the code found here
http://livecodeshare.runrev.com/stack/7 ... administer
franco
Re: revDatabaseColumnNames: revdberr,syntax error"
Posted: Fri Mar 11, 2016 8:04 am
by SparkOut
Where tcurtab is a variable containing the table name it should not be quoted, the query will be looking for a table literally named "tcurtab". (Your first example).
If the table name literally is "curtab" then it should be in quotes ( your second example).
Re: revDatabaseColumnNames: revdberr,syntax error"
Posted: Fri Mar 11, 2016 5:09 pm
by francof
SparkOut wrote:Where tcurtab is a variable containing the table name it should not be quoted, the query will be looking for a table literally named "tcurtab". (Your first example).
If the table name literally is "curtab" then it should be in quotes ( your second example).
Hi,
so in the exemple of the dictionary:
get revDatabaseColumnNames(tConnectionId, "myTable")
myTable is a constant?
here the original code who give error:
Code: Select all
on aggiornatabella
put the label of button tabelle into curtab
#puliamo la tabella
set the dgData of group "tabellona" to empty
#connessione
put the connID of this stack into connID
if connID is not empty then
#recuperiamo le colonne
put revDatabaseColumnNames(connID, curtab ) into titoli
replace "," with return in titoli
#aggiungiamo il rowid della riga per rendere unica la selezione
put "rowid" & return before titoli
set the dgProp["columns"] of group "tabellona" to titoli
#recuperiamo i dati
put "SELECT rowid,* FROM " & curtab into tSQL
##old way to populate datagrid
##put revDataFromQuery(tab,return,connID,tSQL) into tRecords
##set the dgtext of group "tabellona" to tRecords
##new way
put revQueryDatabase( connID, tSQL) into theCursor
ConvertSQLCursorToArray theCursor, theDataGridArray
set the dgData of group "tabellona" to theDataGridArray
revCloseCursor theCursor
##
set the dgColumnWidth["rowid"] of group "tabellona" to 30
set the dgColumnTooltip["rowid"] of group "tabellona" to "This is internal, it doesn't exist"
set the dgColumnLabel["rowid"] of group "tabellona" to " " #se metti empty, usa il nome
end if
end aggiornatabella
Downloadable here
http://livecodeshare.runrev.com/stack/7 ... administer
best
franco
Re: revDatabaseColumnNames: revdberr,syntax error"
Posted: Sat Mar 12, 2016 5:17 pm
by quailcreek
I would suggest not using the same variable name in both places.
Code: Select all
put the connID of this stack into connID
Code: Select all
put the uConnID of this stack into tConnID
Re: revDatabaseColumnNames: revdberr,syntax error"
Posted: Sun Mar 13, 2016 12:31 pm
by francof
quailcreek wrote:I would suggest not using the same variable name in both places.
Code: Select all
put the connID of this stack into connID
Code: Select all
put the uConnID of this stack into tConnID
Hi Tom
I've changed the names as you suggested but error still remain.
ciao
franco
Re: revDatabaseColumnNames: revdberr,syntax error"
Posted: Sun Mar 13, 2016 5:48 pm
by quailcreek
Take out the comma after rowid and the *.
Code: Select all
put "SELECT rowid,* FROM " & curtab into tSQL
Code: Select all
put "SELECT rowid FROM " & curtab into tSQL
Also, it's a good idea to quote literals.
Code: Select all
put the label of button "tabelle" into curtab
Re: revDatabaseColumnNames: revdberr,syntax error"
Posted: Sun Mar 13, 2016 7:22 pm
by francof
once again error at same line
Code: Select all
put revDatabaseColumnNames (tConnID, curtab ) into titoli
do you have tried to download the complete code? and if yes do it works for you?
quailcreek wrote:
...
Also, it's a good idea to quote literals.
Code: Select all
put the label of button "tabelle" into curtab
I always do this. in this case I haven't controlled the whole code.
best
franco