I then added a new function to eXpress++ name DC_WorkArea2Html().
With this new code, I can now query data on a remote server by entering a SQL statement in a web browser.
This is the HTML form:
Code: Select all
<form action="http://192.168.0.53:8001/sqlservice/query">
Enter SQL SELECT Statement:<br>
<textarea rows=4 cols=100 name="sql">
select mednum as Medallion, Make, Model, Type, Fuel from mn_mdn where Left(make,4) = 'Ford'
</textarea>
<p>
<input TYPE="submit" NAME="SqlStatement" VALUE="Run Sql!">
</form>
This output is then returned to the web browser, which can be on a tablet or a phone.
If you are using SqlQuery and have an interest in this capability, please let me know.
I would like to improve on this and make it more robust.
This uses the HttpEndPoint and WebHandler features of Xbase++ 2.0 and is very simple to implement with a few lines of code.
Look at how the changes to the command line interface are used to invoke SqlQuery to run the SQL statement and produce the output:
Code: Select all
METHOD SqlService:query( cSql )
LOCAL cParams, cHtml
cParams := '/co:ADS_1 /sq:"' + cSql + '" /ee:reply.htm'
Runshell(cParams,'sqlquery.exe')
IF File('reply.htm')
cHtml := MemoRead('reply.htm')
ELSE
cHtml := 'Cannot run your query'
ENDIF
RETURN cHtml