Skip to main content

How to print database record

3 replies [Last post]
mozum
Offline
Joined: 2012-05-01
Points: 0

Please i need your help once more. Can you help me with codes on how to print records from access database on clicking a button.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
dhoundiyal
Offline
Joined: 2013-01-30
Points: 0

try{
Connection conn;
Statement st;
ResultSet rs;
Class.forName("connection string");
conn=DriverManager.getConnection("connection string");
st=conn.createStatement();
rs = st.executeQuery("select * from registration");

while(rs.next())
{
String n=rs.getString(1);
String m= rs.getString(2);
String b=rs.getString(3);
/* print the variable*/
}
catch(Exception e)
{
System.out.println(e);
}

mozum
Offline
Joined: 2012-05-01
Points: 0

Thanks alot for your help. But that was not what i meant. I mean how to send a printer job to a printer from a database record on clicking a button.

oshanz
Offline
Joined: 2013-03-06
Points: 0