关于android数据库查询操作的问题
publicUserfind(intid){db=helper.getWritableDatabase();Cursorcursor=db.rawQuery("selec...
public User find(int id)
{
db = helper.getWritableDatabase();
Cursor cursor = db.rawQuery("select mima from userdb where id =?", new String[]
{ String.valueOf(id) });
if (cursor.moveToNext())
{
return new User(cursor.getString(cursor.getColumnIndex("mima"));//这行有错误
}
return null;
}
错误提示:
Multiple markers at this line
- The constructor User(String) is
undefined
我是模仿这段代码写的,本人初学者,求大神指教
public Student find(int sid)
{
db = helper.getWritableDatabase();
Cursor cursor = db.rawQuery("select sid,name,age from t_student where sid = ?", new String[]
{ String.valueOf(sid) });
if (cursor.moveToNext())
{
return new Student(cursor.getInt(cursor.getColumnIndex("sid")), cursor.getString(
cursor.getColumnIndex("name")), cursor.getShort(cursor.getColumnIndex("age")));
}
return null;
}
错误提示是:he constructor User(String) is undefined,刚刚的忘了加一个括号 展开
{
db = helper.getWritableDatabase();
Cursor cursor = db.rawQuery("select mima from userdb where id =?", new String[]
{ String.valueOf(id) });
if (cursor.moveToNext())
{
return new User(cursor.getString(cursor.getColumnIndex("mima"));//这行有错误
}
return null;
}
错误提示:
Multiple markers at this line
- The constructor User(String) is
undefined
我是模仿这段代码写的,本人初学者,求大神指教
public Student find(int sid)
{
db = helper.getWritableDatabase();
Cursor cursor = db.rawQuery("select sid,name,age from t_student where sid = ?", new String[]
{ String.valueOf(sid) });
if (cursor.moveToNext())
{
return new Student(cursor.getInt(cursor.getColumnIndex("sid")), cursor.getString(
cursor.getColumnIndex("name")), cursor.getShort(cursor.getColumnIndex("age")));
}
return null;
}
错误提示是:he constructor User(String) is undefined,刚刚的忘了加一个括号 展开
1个回答
2014-05-24
展开全部
new User(cursor.getString(cursor.getColumnIndex("mima")));
最右边少了个括号吧
追问
我知道,加了括号还是错的,我有补充在后面
追答
报什么错。
七鑫易维信息技术
2024-09-02 广告
2024-09-02 广告
Play Video 七鑫易维是致力于机器视觉和人工智能领域的高新科技企业,迄今已专注眼球追踪技术的研发、创新与应用超过14年,拥有完全自主知识产权,全球专利总量655余项。 作为眼球追踪技术领域的全球知名品牌,七鑫易维的产品体系覆盖眼动分...
点击进入详情页
本回答由七鑫易维信息技术提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询