很简单。
定义结果集类
比如:
package com.tt.genwesite.ui;/**
* Title:TbooksShow.java
* Description:数据库封装
* Copyright: Copyright (c) 2002
* Company:tidetime
* @author dongdongshu
* @version 1.0
*/public class TbooksShow { public TbooksShow() {
id=-1;
classIdentify="";
Temp_class="";
TypeIdentify=""; enType="";
cnType="";
TitleId=-1;
enTitle="";
cnTitle="";
parentTitle="";
audioPath="";
picPath="";
segmentNum=-1;
Vocabulary="";
inputTime="";
note="";
}
public int id;
public String classIdentify;
public String Temp_class;
public String TypeIdentify; public String enType;
public String cnType;
public int TitleId;
public String enTitle;
public String cnTitle;
public String parentTitle;
public String audioPath;
public String picPath;
public int segmentNum;
public String Vocabulary;
public String inputTime;
public String note;
}
剩下的操作很简单了……
定义结果集类
比如:
package com.tt.genwesite.ui;/**
* Title:TbooksShow.java
* Description:数据库封装
* Copyright: Copyright (c) 2002
* Company:tidetime
* @author dongdongshu
* @version 1.0
*/public class TbooksShow { public TbooksShow() {
id=-1;
classIdentify="";
Temp_class="";
TypeIdentify=""; enType="";
cnType="";
TitleId=-1;
enTitle="";
cnTitle="";
parentTitle="";
audioPath="";
picPath="";
segmentNum=-1;
Vocabulary="";
inputTime="";
note="";
}
public int id;
public String classIdentify;
public String Temp_class;
public String TypeIdentify; public String enType;
public String cnType;
public int TitleId;
public String enTitle;
public String cnTitle;
public String parentTitle;
public String audioPath;
public String picPath;
public int segmentNum;
public String Vocabulary;
public String inputTime;
public String note;
}
剩下的操作很简单了……
*不喜欢循环for那就递规好了 ^o^
*/
public String GetWannaByStateMent(String StateMent,int Row)
{
String wanna = "";
String strSql = "SELECT COUNT(*) TOTALCOUNT FROM TABLE WHERE STATEMENT = '" + StateMent + "'";
try
{
ResultSet rs = execQuery(strSql);//execQuery为你的执行Sql的函数
while(rs.next())
{
if (rs.getInt("TOTALCOUNT")==0)
{
wanna = "";
}else
{
wanna = GetWanna1ByXY(rs.getInt("TOTALCOUNT"),Row);
}
}
}
catch (Exception ex)
{
System.out.println("他爷爷的,GetWannaByStateMent报错了^o^" + ex.toString());
}
return wanna;
}
{
try
{
int xx=1;
int yy=1;
xx = X;
yy = Y;
String wanna1 = "";
if (xx>0)
{
wanna1 = GetWanna1ByXY(xx--,yy) + GetWanna2ByY(yy);
}else
{
wanna1 = "";
}
}catch(Exception ex)
{
System.out.println("他爷爷的,GetWanna1ByXY报错了^o^" + ex.toString());
}
return wanna1;
}
{
try
{
int yyy=1;
yyy = Y;
String wanna2 = "";
if (yyy>0)
{
wanna2 = GetWanna2ByY(yyy--) + wanna2 ;
}else
{
wanna2 = "";
}
}catch(Exception ex)
{
System.out.println("他爷爷的,GetWanna2ByY报错了^o^" + ex.toString());
}
return wanna2;
}