HOW DO U MAKE BAR CHARTS ETC USING JSP AND A MySQL DATABASE
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   bally_jagpal
Posted On:   Tuesday, March 18, 2003 08:27 AM

I am currently using jsp and a mysql database.however i was wondering if there is a way to produce a chart by getting the data from a table of say customers and create a table relating to this informatio.

Re: HOW DO U MAKE BAR CHARTS ETC USING JSP AND A MySQL DATABASE

Posted By:   Joost_Schouten  
Posted On:   Tuesday, March 18, 2003 08:37 AM

Do you just want to print the resultSet of a select query to a HTML query? if so, the folowing is what I use for testing puposes.



public String printTestQuery(String query){
StringTokenizer strt = new StringTokenizer(query);
String table="<" + "table border=1 width="100%"><" + "tr>";
if(strt.nextToken().equalsIgnoreCase("select")){
try{
connection.executeQuery(query);
for(int i = 1; i-1 < connection.getColumnCount(); i++){
table = table + "<" + "td><" + "b>" + connection.getColumnName(i) + "";
}
while(connection.getNextItem()){
table = table + "<" + "tr>";
for(int x = 1; x-1 < connection.getColumnCount(); x++){
String value = (connection.getString(x) == null)?" ":connection.getString(x);
table = table + "<" + "td>" + value + "<" + "/td>";
}
table = table + "";
}
table = table + "";
}catch(SQLException e){
table = "<" + "b>Something is wrong with your query:<" + "/b> " + e.toString();
}
}
else{
try{
int count = connection.executeUpdate(query);
table = count + " rows are inserted/updated/droped with the above listed query";
}catch(SQLException e){
table = "<" + "b>Something is wrong with your query:<" + "/b> " + e.toString();
}
}
return table;
}

Good luck,

Joost
About | Sitemap | Contact