📄 appletprama.java
字号:
/*
* 创建日期 2004-9-19
*
* 更改所生成文件模板为
* 窗口 > 首选项 > Java > 代码生成 > 代码和注释
*/
package javabean;
import java.sql.*;
import java.util.Vector;
/**
* @author jk011
*
* 更改所生成类型注释的模板为
* 窗口 > 首选项 > Java > 代码生成 > 代码和注释
*/
//为APPLET小应用程序提供数据而写的类
public class AppletPrama {
Database database=null;
public AppletPrama(Connection con)
{
database=new Database();
database.setCon(con);
}
public String getMaxdate(String code)
{
String date=null;
String str="select max(timedate) as timedate from data where code='"+code+"'";
try
{
ResultSet rs=database.Query(str);
if(rs.next())
date=rs.getString("timedate");
}
catch(SQLException e){}
return date;
}
public String getMindate(String code)
{
String date=null;
String str="select min(timedate) as timedate from data where code='"+code+"'";
try
{
ResultSet rs=database.Query(str);
if(rs.next())
date=rs.getString("TIMEDATE");
}
catch(SQLException e){}
return date;
}
public String getTitle(String code)
{
String title=null;
String str="select distinct(title) from kind where code='"+code+"'";
try
{
ResultSet rs=database.Query(str);
if(rs.next())
title=rs.getString("title");
}
catch(SQLException e){}
return title;
}
public String getDanwei(String code)
{
String danwei=null;
String str="select distinct(danwei) from kind where code='"+code+"'";
try
{
ResultSet rs=database.Query(str);
if(rs.next())
danwei=rs.getString("danwei");
}
catch(SQLException e){}
return danwei;
}
public String getKind(String code)
{
String kind=null;
String str="select distinct(kind) from HANGQING where code='"+code+"'";
try
{
ResultSet rs=database.Query(str);
if(rs.next())
kind=rs.getString("kind");
}
catch(SQLException e){}
return kind;
}
public float getMaxprice(String code,String mindate,String maxdate)
{
float maxprice=0;
String str="select price from data where timedate between '"+mindate+"'"+" and '"+maxdate+"' and code='"+code+"' order by price desc";
try
{
ResultSet rs=database.Query(str);
if(rs.next())
maxprice=rs.getFloat("price");
}
catch(SQLException e){}
return maxprice;
}
public float getMinprice(String code,String mindate,String maxdate)
{
float minprice=0;
String str="select price from data where timedate between '"+mindate+"'"+" and '"+maxdate+"' and code='"+code+"' order by price";
try
{
ResultSet rs=database.Query(str);
if(rs.next())
minprice=rs.getFloat("price");
}
catch(SQLException e){}
return minprice;
}
public Vector getAllprice(String code,String mindate,String maxdate)
{
Vector vec=new Vector();
String str="select price,timedate from data where timedate between '"+mindate+"'"+" and '"+maxdate+"' and code='"+code+"' order by timedate";
try
{
ResultSet rs=database.Query(str);
while(rs.next())
{
DataClass hqclass=new DataClass();
hqclass.setTimedate(rs.getString("timedate"));
hqclass.setPrice(rs.getFloat("price"));
vec.add(hqclass);
}
}
catch(SQLException e){return null;}
return vec;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -