开发者

assigning value from a query?

开发者 https://www.devze.com 2023-02-11 00:46 出处:网络
I am writing a java program which will create a database LocalStations where it needs a value maxS开发者_JAVA百科tationid

I am writing a java program which will create a database LocalStations where it needs a value maxS开发者_JAVA百科tationid

int maxStationId;

I want to assign maxStationId with the total number of cells in the table STATION.. how can i do that ?


You have to write a jdbc program, which executes select count(*) from localstations sort of query that returns to the total count, assign the return value to ur variable .


Can you please elaborate your question? Number of cells as in (number of columns)*(number of rows)?

If thats what you want, then you can use java.sql.ResultSetMetaData


Is this what you are asking for

  st.executeQuery ("CREATE TABLE LocalStations select * from STATION");
0

精彩评论

暂无评论...
验证码 换一张
取 消