开发者

How to store the textbox data in local SQL Server db in blackberry application?

I am having two controls on main screen one is text box and other is button.

On button click, i want to store textbox data into one of my sql server table.

As i am newbie in BB dev, so not sure which approach i have to follow to achieve this.

Any help or lights on this will be really appr开发者_运维技巧eciated.

Thanks in advance !!


You can get data from textbox using textbox.getText();

Store it as string and then you can insert this data referring this code:

 try
        {
            URI myURI = URI.create("file:///SDCard/Databases/SQLite_Guide/" +
                                   "MyTestDatabase.db"); 
            d = DatabaseFactory.open(myURI);

            Statement st = d.createStatement("INSERT INTO People(textboxid) " +
                                             "VALUES (textbox.getText())");
            st.prepare();
            st.execute();
            st.close();
            d.close();

        }
        catch ( Exception e ) 
        {         
            System.out.println( e.getMessage() );
            e.printStackTrace();
        }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜