Before you try to fix that, you need to change your whole app: Never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Always use Parameterized queries instead.
When you concatenate strings, you cause problems because SQL receives commands like:
SELECT * FROM MyTable WHERE StreetAddress = 'Baker's Wood'
The quote the user added terminates the string as far as SQL is concerned and you get problems. But it could be worse. If I come along and type this instead: "x';DROP TABLE MyTable;--" Then SQL receives a very different command:
SELECT * FROM MyTable WHERE StreetAddress = 'x';DROP TABLE MyTable;
Which SQL sees as three separate commands:
SELECT * FROM MyTable WHERE StreetAddress = 'x';
A perfectly valid SELECT
DROP TABLE MyTable;
A perfectly valid "delete the table" command
And everything else is a comment.
So it does: selects any matching rows, deletes the table from the DB, and ignores anything else.
So ALWAYS use parameterized queries! Or be prepared to restore your DB from backup frequently. You do take backups regularly, don't you?
When you've done that, start looking at you current problem, if it still exists.
But we can't help you with that: the two time differences you show are 25 seconds apart, so it's likely that your code is executing twice at different times - you will have to use the debugger to find out exactly what is happening, and then start thinking about why - and we can't do that for you!
But ... if you are expecting the "Auto_no" to be different each time, then you are definitely doing it wrong - you should not be trying to set it to a value from your presentation software, you should be letting the DB handle that - particularly with a server based system which is inherently multiuser. Generating it outside the DB is a good way to get some really, really nasty intermittent bugs which can meww your whole DB up beyond hope of repair. Consider using an IDENTITY field instead.