Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 06-07-2009
Member
 
Join Date: Jul 2009
Posts: 6
How to Print Rows of SQL Database

Please how can I print the contents of SQL Database in VB6 Application?

I want to be able click a button in VB6 and it will print the rows of a SQL database. I want to print one row per page.

For e.g

Page 1
Name Surname Age



Page 2

Name Surname Age
Reply With Quote
  #2  
Old 06-07-2009
Member
 
Join Date: Aug 2007
Posts: 1,098
Re: How to Print Rows of SQL Database

i think there must be option in file menu for printing other wise you can convert it to excel and go for print ...ActiveX Data Objects (ADO) provide access to any type of data source. It is a flat object model with few objects. check here for more How to import data from Microsoft SQL Server into Microsoft Excel
Reply With Quote
  #3  
Old 06-07-2009
Member
 
Join Date: Dec 2008
Posts: 202
Re: How to Print Rows of SQL Database

If you want to rewrite some modifications to an SQL table, first you need a select ZSQL method, and an Update SQL Tool Object. You need to use the fetchRow( ) and fetchInto( ) methods in your database and put data in numeric arrays. And in your program you need to use associative arrays or objects by passing an additional parameter to either method. For associative arrays, use DB_FETCHMODE_ASSOC:

create table utest
(id integer not null primary key,
name varchar(100) not null,
is_male smallint,
birth_date date,
birth_time time,
modified timestamp);

Code:
    while($row = $sth->fetchRow(DB_FETCHMODE_ASSOC)) {
        print $row['sign']."\n";
    }

    while($sth->fetchInto($row,DB_FETCHMODE_ASSOC)) {
        print $row['sign']."\n";
    }
For objects, use DB_FETCHMODE_OBJECT:
Code:
    while($row = $sth->fetchRow(DB_FETCHMODE_OBJECT)) {
        print $row->sign."\n";
    }

    while($sth->fetchInto($row,DB_FETCHMODE_OBJECT)) {
        print $row->sign."\n";
    }
Reply With Quote
  #4  
Old 06-07-2009
Member
 
Join Date: Jul 2009
Posts: 6
Re: How to Print Rows of SQL Database

Please can someone post a working example.

Preferably in a button click event.

I want to click a button in visual Basic an it will print SQL database contents to a selected printer.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags:



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to Print Rows of SQL Database"
Thread Thread Starter Forum Replies Last Post
Getting Error " Print titles must be contiguous and complete rows or columns" on Excel LynchL Windows Software 3 31-12-2011 05:04 PM
Open and print Access Database without access? Boagrius Software Development 6 28-08-2010 11:28 PM
Using current XP Print drivers and Windows 7 Print drivers on 2003 Print Server Richcom Operating Systems 3 28-07-2010 10:19 PM
Merging duplicate names not rows copy rows into new workbook each time VBA Excel 2003 awkwardsmile Software Development 2 09-07-2009 08:57 AM
Print spooler hangs when trying to print from a shared print Jisbomb Windows XP Support 3 27-07-2007 10:17 PM


All times are GMT +5.5. The time now is 01:22 AM.