Page 1 of 1
Sql Server 2005 with HMG: print
Posted: Mon Jan 26, 2009 12:22 pm
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.
Re: Sql Server 2005 with HMG: print
Posted: Tue Jan 27, 2009 1:34 pm
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.
Re: Sql Server 2005 with HMG: print
Posted: Tue Jan 27, 2009 9:54 pm
by Cartago
Hi, Luis.
Thank you very much for your reply. It is very clear. I tried and it worked.
Best regards.