Cursor1 SQL1.ExecQuery = ("SELECT cosa FROM articoli where categoria like '" & main.Cercacategorie & "' ORDER BY cosa")
I often see that programmers concatenate their select statement string with variables like this.
Be aware that this is not very good technique for the SQL engine. Every time you create a statement like this it is a completely NEW statement for the SQL engine so the statement has to be parsed again, a new execution plan has to be found and so on. A better way is to use ExecQuery2 like this:
SQL1.ExecQuery2 = ("SELECT cosa FROM articoli where categoria like ? ORDER BY cosa", array as string(main.Cercacategorie))
So every time you call this statement the SQL engine recognizes that this is a statement called before and can use the cached execution plan.
If you do many select statements like this then the performance will increase.