是否可以将整个数据库表、行和列提取到黑莓中的表单中?我已经能够将记录中的值检索到富文本字段中,但我想将它们检索到文本框中,以便可以从表单中更新各个列和行。这是我一直在研究的代码
//Retrieve data
try
{
add(new RichTextField("Attempting to retrieve data from " +
"database1.db on the SDCard."));
Statement st = db.createStatement("SELECT name,email FROM DirectoryItems");
st.prepare();
Cursor c = st.getCursor();
Row r;
int i = 0;
while(c.next())
{
r = c.getRow();
i++;
add(new RichTextField(i + ".Name = " + r.getString(0) +
" , " +
"Email = " + r.getString(1))); //+
// " , " +
//"Phone = " + r.getInteger(1)));
}
if (i==0)
{
add(new RichTextField("No data in the DirectoryItems table."));
}
st.close();
db.close();
}
catch( Exception e )
{
System.out.println( e.getMessage() );
e.printStackTrace();
}