How to get the value of mysql Query.....
Hi Friends,
I am running this query thorugh JSP :
rst = stmt.executeQuery("select count(*) from information_schema.columns where table_name='countrylist';");
Here this query returns that how many columns the table countrylist have....
But My problem is How I can take this value in a variable for my further process.
ple help me out....
[375 byte] By [
Ravijia] at [2007-11-26 16:31:30]

> Hi Friends,
> I am running this query thorugh JSP :
> rst = stmt.executeQuery("select count(*) from
> information_schema.columns where
> table_name='countrylist';");
First, consider using prepared statements, although it' snot much of a problem with this example.
Second, consider applying good application design by maintinging strict MVC and multi-tier separation. JSPs shouldn't even know that there's something like a database, and certainly not access one.
> Here this query returns that how many columns the
> table countrylist have....
> But My problem is How I can take this value in a
> variable for my further process.
> ple help me out....
You mean "how to use the result set"? Consider reading the API or at least using Google...
http://www.google.com/search?q=resultset+examples
Hi CeciNEstPasUnProgrammeur,
Thanks for your valuable reply......but tell me in this example how i can get the integer value of query.....
I know how to use rst(ResultSet)...
Actually i have an application where i have to read data from database to excel file but i am stucking on column value. when i am giving hardcorded value for the column according to table it's working well but i don't want to do it..it should be dynamically.
so i want the integer value of that query....ple help me regarding this....