Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQLExecute() problem

Status
Not open for further replies.

EdenD

Programmer
Jun 1, 2001
13
0
0
PH
I have a program which retrieves record from the SQL table. This is the program:

STORE SQLCONNECT('dbcsqllibrary', 'sa') TO lnConnHandle
IF lnConnHandle <= 0
MESSAGEBOX('Cannot make connection', 16, 'SQL Connect Error')
ELSE
MESSAGEBOX('Connection made', 48, 'SQL Connect Message')
lcSQLString1 = &quot;Select libauthrid from tblmstrlibauthor where libauthrid = &quot; + lcAuthorID
lcSQLString2 = &quot; and libauthorfname = &quot; + &quot;'&quot;+ lcAuthorFName + &quot;'&quot;
lcSQLString3 = &quot; and libauthormname = &quot; + &quot;'&quot;+ lcAuthorMName + &quot;'&quot;
lcSQLString4 = &quot; and libauthorlname = &quot; + &quot;'&quot;+ lcAuthorLName + &quot;'&quot;
lcSQLString = lcSQLString1 + lcSQLString2 + lcSQLString3 + lcSQLString4
SQLSETPROP(lnConnHandle,&quot;BatchMode&quot;,.T.)
lnResult = SQLEXEC(lnConnHandle,lcSQLString,&quot;MyAuthorCursor&quot;)
ENDIF
SQLDISCONNECT(lnConnHandle)

***********
From this I would like to browse the sets of records retrieved thru this SQLEXEC() command. But I cannot. How would I be able to view the records in MYAuthorCursor?
 
lnResult = SQLEXEC(lnConnHandle,lcSQLString,&quot;MyAuthorCursor&quot;)
What is the result of lnResult. Does it return a cursor or is the reult no data at all.

HTH,
Weedz (Wietze Veld)
My private project:Download the CrownBase source code !!
 
Try changing it to something like:

lnResult = SQLEXEC(lnConnHandle,lcSQLString,&quot;MyAuthorCursor&quot;)
IF lnResult >= 0
SELECT MyAuthorCursor
BROWSE
ELSE
AERROR(myerror)
LIST MEMORY LIKE myerror
*Analyze the error
ENDIF

If you dont get a browse window, you should get an error message printed to screen that you will need to evaluate. FYI - If the SQL is successful, even if it returns no data, the cursor will be created, which is browsable. Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top