How can I print a table in SQL Server 2005 with HMG? Can you print directly as if it were a dbf?
Thank you.
Sql Server 2005 with HMG: print
Moderator: Rathinagiri
- luisvasquezcl
- Posts: 1258
- Joined: Thu Jul 31, 2008 3:23 am
- Location: Chile
- Contact:
Re: Sql Server 2005 with HMG: print
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.
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
Hi, Luis.
Thank you very much for your reply. It is very clear. I tried and it worked.
Best regards.
Thank you very much for your reply. It is very clear. I tried and it worked.
Best regards.