执行Insert语句时出现问题
你好.. 我创建了一个数据库,里面有一个表。 现在,当我在表中插入一个值时,它不起作用...... 请告诉我如何查看 eclipse 插件中发生的错误。我对黑莓很陌生。 现在插入值的代码片段是
Database d;
URI myUri = URI.create("file:///SDCard/Databases/SQLite_Guide/", "Mynewdatabase1.db");
d= DatabaseFactory.create(myUri);
d.close;
Statement s1=d.createStatement("INSERT INTO People(Name,Age)VALUES ('uttam',23)");
s1.prepare();
s1.execute();
s1.close();
d.close();
HI..
I have a database created and having a table inside it..
now when i am inserting a value in my table it doesnot work...
And please tell me how to see the error if occurs in the eclipse plug in . I am very new to blackberry.
now the snippet code for inserting the value is
Database d;
URI myUri = URI.create("file:///SDCard/Databases/SQLite_Guide/", "Mynewdatabase1.db");
d= DatabaseFactory.create(myUri);
d.close;
Statement s1=d.createStatement("INSERT INTO People(Name,Age)VALUES ('uttam',23)");
s1.prepare();
s1.execute();
s1.close();
d.close();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您要在调用
createStatement
之前关闭数据库吗?那是行不通的。这是实际的代码吗,因为第一次调用时缺少括号:d.close;
You're closing the data base before calling
createStatement
? That isn't going to work. Is this the actual code, because the first you're missing the parens on the first call:d.close;