JICGreg
Technical User
- Mar 14, 2007
- 34
I have had foxpro and sql work together for a while now, but only in the very,very simplest of terms. I basically delete data in a sql table and add it back in using a foxpro view.
I now have to query the sql table. I am trying to do this within a foxpro program.
So here is what I have:
store "returns" to sql_source_table
store "ABCD" to ticker
lnconn = "sqlconnect("JICData",.T.)
STORE "SELECT FROM * " + sql_source_table + " where ticker = " + "'" + ticker + "'" TO table_SELECT
sqlexec(lnconn,table_select)
What I think I'm sending to sql is: 'SELECT FROM RETURNS WHERE TICKER = 'ABCD'
My first question does this look correct? I know that query will work in sql management studio.
My second question is how can I tell if it works? There has to be a way to see the records that are returned. At first I thought I would simply say view_returns (the remote view name I have been using) but, while that brings up the remote view, it is not specific to the query (in other words it is all data).
I do not really know anything about cursors but that seems to be one way to 'see' the results of the query. I added the phrase into cursor temp after the WHERE TICKER = ABCD phrase. When I issued the sqlexec command, it did not bomb, but likewise no cursor window popped up to let me see the results. I also added browse right after the sqlexec line and that did not do anything.
Any help would be greately appreciated.
Greg
I now have to query the sql table. I am trying to do this within a foxpro program.
So here is what I have:
store "returns" to sql_source_table
store "ABCD" to ticker
lnconn = "sqlconnect("JICData",.T.)
STORE "SELECT FROM * " + sql_source_table + " where ticker = " + "'" + ticker + "'" TO table_SELECT
sqlexec(lnconn,table_select)
What I think I'm sending to sql is: 'SELECT FROM RETURNS WHERE TICKER = 'ABCD'
My first question does this look correct? I know that query will work in sql management studio.
My second question is how can I tell if it works? There has to be a way to see the records that are returned. At first I thought I would simply say view_returns (the remote view name I have been using) but, while that brings up the remote view, it is not specific to the query (in other words it is all data).
I do not really know anything about cursors but that seems to be one way to 'see' the results of the query. I added the phrase into cursor temp after the WHERE TICKER = ABCD phrase. When I issued the sqlexec command, it did not bomb, but likewise no cursor window popped up to let me see the results. I also added browse right after the sqlexec line and that did not do anything.
Any help would be greately appreciated.
Greg