?? gettemplatetype.java
字號:
package com.v246;
/*
*本類用于迭帶顯示數據庫中所有模板類型及ID
**/
public class GetTemplateType
{
protected java.sql.Connection conn=null;
protected java.sql.Statement stm=null;
protected java.sql.ResultSet rs=null;
protected Connections connTmp=new Connections();
protected java.util.Collection coll=new java.util.ArrayList();
public GetTemplateType()throws Exception
{
String id;
String type;
String query="select * from TemplateType";
try
{
conn=connTmp.getConnection();
stm=conn.createStatement();
}
catch(Exception ex)
{
throw new Exception("Initialize conn or stm error in GetTemplateType.class 16-20");
}
try
{
rs=stm.executeQuery(query);
while(rs.next())
{
id=rs.getString("Id");
type=rs.getString("Type");
addCollection(new TemplateType(id,type));
}
}
catch(Exception e)
{
throw new Exception("read Template error in GetTemplateType.class 19--27");
}
finally
{
if(rs!=null)rs.close();
if(stm!=null)stm.close();
if(conn!=null)conn.close();
}
}
public void addCollection(TemplateType type)
{
coll.add(type);
}
public java.util.Collection getColl()
{
return coll;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -