关于java数据库的一个问题
public static List<String> selectJSDatabase(String timeold)
{
createorOpenDatabase();
List<String> alist=new ArrayList<String>();
try
{
String sql="select * from jsRecord where time= "+ timeold ;
Cursor cur=sld.rawQuery(sql, new String[]{});
while(cur.moveToNext())
{
alist.add(cur.getString(1));
alist.add(cur.getString(2));
}
cur.close();
}
catch(Exception e)
{
e.printStackTrace();
}
closeDatabase();
return alist;
}
这是我写的一个函数
其中String sql="select * from jsRecord where time= "+ timeold ;这句话中timeold是个变量,这种写法是不是不对,为什么直接跳到catch了