0

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 appreciated.

Thanks in advance !!

Raghav
  • 93
  • 1
  • 7

1 Answers1

0

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();
        }
Himanshu Dudhat
  • 1,609
  • 3
  • 14
  • 27