开发者

assigning value from a query?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜