Search code examples
sql-servervisual-foxprodatabase-cursor

Cursor object is not found in Visual FoxPro


I have a database containing a table called client that has, among others, column names like id, first, last,...

It is projected to extract each record and from it, assemble a PDF file named after that client using his/her id, first, and last name

I have this visual FoxPro script that should do that but it is not working. I am getting Object Client is not found error.

sqlCn is a connection handle to a SQL Server DB.

RC=SQLEXEC(sqlCn ,"Select * from Client","client")
SELECT client
SCAN
F_PDF = PADL(ALLTRIM(client.Id.Value), 8, "0") + "_" + ALLTRIM(client.FIRST.Value) + "_" + ALLTRIM(client.LAST.Value)
F_PDF = STRTRAN(F_PDF, "/", "_")
F_PDF = STRTRAN(F_PDF, "\", "_")
F_PDF = STRTRAN(F_PDF, ".", "") + ".pdf"
ENDSCAN

Solution

  • Why do you attach a 'Value' to each of them? client is an alias according to your code, not an object. You should write that as:

    PADL(ALLTRIM(client.Id), 8, "0") + "_" + ALLTRIM(client.FIRST) + "_" + ALLTRIM(client.LAST)