Sql Server 2005 with HMG: print

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
Cartago
Posts: 13
Joined: Sun Dec 28, 2008 12:48 pm

Sql Server 2005 with HMG: print

Post by Cartago »

How can I print a table in SQL Server 2005 with HMG? Can you print directly as if it were a dbf?
Thank you.

User avatar
luisvasquezcl
Posts: 1184
Joined: Thu Jul 31, 2008 3:23 am
Location: Chile
Has thanked: 16 times
Been thanked: 18 times
Contact:

Post by luisvasquezcl »

Hi Cartago,
You must create a recordset of the table to list and go with a while loop.
for example: use a table clients with ado.
Local oConexion, otable

oConexion = TOleauto():New('ADODB.Connection')
oConexion:ConnectionString ='Provider=Microsoft.Jet.OLEDB.4.0;'+;
'Data Source=MyDatabase.mdb;'+;
'User Id=Admin;'+;
"Password=;"
oConexion:Open()

oTable := oTable:CursorLocation = adUseClient
oTable:Open( "Select * from clients", oConexion, adOpenDynamic, adLockOptimistic )
if oTable:State = adStateClose
msgstop('Msg error')
Endif

// Init printer commands
// List data
Do While !oTable:eof()
@ row, col say oTable:Fields('Name'):Value to print
@ row, col say oTable:Fields('Last'):Value to print
oTable:MoveNext()
Enddo
oTable:close()
oConexion:Close()

It's all.
Regards,
Luis Vàsquez.

Cartago
Posts: 13
Joined: Sun Dec 28, 2008 12:48 pm

Post by Cartago »

Hi, Luis.
Thank you very much for your reply. It is very clear. I tried and it worked.
Best regards.

Post Reply