请高手帮忙加下java代码注释(4)
来源:百度知道 编辑:UC知道 时间:2024/09/28 10:32:05
import java.sql.*;
import java.util.*;
import java.io.*;
public class bulletin_intro
{
public String bulletin_title;
public Collection col=new ArrayList();
public Connection con;
public Collection b_intro() throws Exception{
try{
Statement statement=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from bulletin_info where bulletin_title='"+bulletin_title+"'";
ResultSet r=statement.executeQuery(sql);
while(r.next())
{
bulletin bul=new bulletin();
bul.setBulletin_title(r.getString(1));
bul.setBulletin_context(r.getString(2));
bul.setBulletin_time(r.getString(3));
col.add(bul);
}
}catch(SQLException ee)
{}
return col;
}
}
import java.sql.*;
import java.util.*;
import java.io.*;
public class bulletin_intro
{
public String bulletin_title;//定义字符串变量bulletin_title
public Collection col=new ArrayList();//建类Collection的对象
public Connection con;
public Collection b_intro() throws Exception{
try{
Statement statement=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from bulletin_info where bulletin_title='"+bulletin_title+"'";
ResultSet r=statement.executeQuery(sql);
while(r.next())
{
bulletin bul=new bulletin();
bul.setBulletin_title(r.getString(1));//设标题
bul.setBulletin_context(r.getString(2));//设内容
bul.setBulletin_time(r.getString(3));//设时间
col.add(bul);//增加
}
}catch(SQLException ee)//载取异常
{}
return col;
}
}