Android Question ExecNonQuery2 Insert using (?)


Hi. My first post so forgive me if you start yawning and getting angry telling me, "you should have searched this post.." I have searched 100s of threads and tried umpteen options but I'm still getting an error.

I'm simply trying to INSERT into my sqlite DB (the code works fine when I commit it in DBBrowser) but I get this error:
java.lang.NullPointerException: Attempt to invoke virtual method 'android.database.sqlite.SQLiteStatement android.database.sqlite.SQLiteDatabase.compileStatement(java.lang.String)' on a null object reference

Here's my code: Every part works perfectly except the INSERT

Private Sub AddEntryGroup
Private Query As String
Private ResultSet1 As ResultSet

'Check for a group name entry

If txtNewGroup.Text = "" Then
Msgbox("You need to enter a Valid group name", "ERROR")
End If

'Check group name is not in use

Query = "SELECT * FROM groups WHERE groupName = ?"
ResultSet1 = Starter.sql.ExecQuery2(Query, Array As String(txtNewGroup.Text))

If ResultSet1.NextRow = True Then

ToastMessageShow("This entry already exists", False)

'if not, add the entry

Query = "INSERT INTO groups (groupName) VALUES (?)"
sql.ExecNonQuery2(Query, Array As String(txtNewGroup.Text))
ToastMessageShow("Entry added", False)

End If


End Sub

Thanks in advance.