getDataSetByQuery problem

I am trying to write a method the value of one field in one record of a table. It seemed getDataSetByQuery is the best way to do this, but its not working.

Here is my code:

var myField = arguments[0]
var myTable = arguments[1]
var myWhere = arguments[2]

var mySql = "Select " + myField + " From " + myTable
if (myWhere > "") 
	mySql = mySql + " Where " + myWhere
	
var dataset = databaseManager.getDataSetByQuery(currentcontroller.getServerName(),mySql,null,1);	
application.output(mySql)
application.output("dataset[0] "+dataset[0]+" dataset[1] "+dataset[1]);

Am I doing something wrong and/or is there a better way to do this?

if (myWhere > “”)

Is this if-statement supposed to say “when myWhere has a value” ?
Because in that case do this:

if(myWhere)

The Sql is getting generated fine, even with the if (myWhere > “”) syntax. Thats not the problem.

The problem is getting the result from that Sql.

myField = dataset.getValue(1, 1); //set column with value in row1 column1