First of all you either use ExecSQL or Open. The former does not return a value the later does. For example when you wish to insert something in the database, you should go with ExecSQL, when you query something from the database go with Open.
Secondly it looks like your query did not return a value so data2(string) is empty. You cannot access data2[1], hence the sigsegv. You have two choice:
1. Test if the query is empty
2. Test if data2 <> ''