sujitopics
Programmer
hai friends
i am new to java
I have a some problem while querying the records
my program is like this
this is working fine.
as i used rs.getInt(1).
it is showing the First Field data of user table.
in the database some data contains only one digit.
in my java program i have to show all the data in a 2 format by adding "0" before that.
how to add a "0" inbefore while showing the records [if the field date is single digit]
i heard that it is possible with string concatenation.
please tell me how to add "0" while showing to the user
Thanks in advance
Yours
Rajesh
import java.sql.*;
public class Select
{
Select()
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"
Connection con = DriverManager.getConnection("Jdbc:Odbc:accessdsn","raj","raj"
Statement st=con.createStatement();
ResultSet rs =st.executeQuery("select * from user"
while (rs.next())
{
System.out.println("Number is "+rs.getInt(1));
}
}
catch(Exception sqle)
{
System.out.println(sqle);
}
}
public static void main (String args[])
{
new Select();
}
}
i am new to java
I have a some problem while querying the records
my program is like this
this is working fine.
as i used rs.getInt(1).
it is showing the First Field data of user table.
in the database some data contains only one digit.
in my java program i have to show all the data in a 2 format by adding "0" before that.
how to add a "0" inbefore while showing the records [if the field date is single digit]
i heard that it is possible with string concatenation.
please tell me how to add "0" while showing to the user
Thanks in advance
Yours
Rajesh
import java.sql.*;
public class Select
{
Select()
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"
Connection con = DriverManager.getConnection("Jdbc:Odbc:accessdsn","raj","raj"
Statement st=con.createStatement();
ResultSet rs =st.executeQuery("select * from user"
while (rs.next())
{
System.out.println("Number is "+rs.getInt(1));
}
}
catch(Exception sqle)
{
System.out.println(sqle);
}
}
public static void main (String args[])
{
new Select();
}
}