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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How To Print SQL Server 2000 Data

Status
Not open for further replies.

stanley1610

Programmer
Mar 22, 2004
42
HK
Hi all,

I am using VFP 6 to connect to SQL Server 2000. I use Cursor Method to retrieve data, like "browse" for DBF.

However, how can we print the output data by printer in the "simulated" browse generated by SQLConnect and Cursor methods? Please help.

-stan
 
Stan,

You can't print the Browse directly. The easiest approach might be to create a simple report which displays the information you want. Alternatively, copy the cursor to a text file, open it in a word processor (or VFP's file editing window), and print it from there.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Check out this command on VFP help:

Code:
DISPLAY [[FIELDS] FieldList] [Scope] [FOR lExpression1] 
   [WHILE lExpression2] [OFF] [NOCONSOLE] [NOOPTIMIZE] 
   [TO PRINTER [PROMPT] | TO FILE FileName [ADDITIVE]]

I think it's what you're looking for.

Gerardo Czajkowski
ltc.jpg
 
Stan,

<< Can I use DISPLAY with Cursor? >>

Yes. It works with the currently selected alias.

One reason I don't particularly like DISPLAY (or LIST, which is similar) is that it spaces the columns very widely, and typically causes each line to overflow to the next, which is unsightly (the OFF option helps reduce the width of the line, but only slightly).

Nevertheless, it is a good way of getting a quick-and-dirty listing.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Thanks a lot for your help, Gerardo Czajkowski and Mike Lewis. My statement is "DISPLAY s_val, code, remark, cpy, nme, otel, faxno, tle, jn, pdt, m_val OFF TO PRINTER"

It printed something out but the output seemed really dirty.
 
By the way, in order to make it more readable,

could we use cursor method in REPORT FORM?

Please advise.

-stan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top