In this post I will show you how to fix an error that appears in my thermal printer plugin that says: Error en el servidor: sql: no rows in result set.

This error says that there are no rows in the database, and you may be wondering what printing has to do with a database, so that is exactly what I will discuss in this post.

sql: no rows in result set

In the first versions of the plugin, there was the option called setImpresora that was to set the printer in which the tickets would be printed by default. Once established, that printer name was stored in a SQLite3 database.

This error is caused because there is no data in the database because you have not invoked setImpresora, so when you try to print it gives you that error because there is no data in the database (there are no rows, that simple).

Later I implemented the imprimirEnImpresora function that allows you to specify which printer to use when printing, by sending it the printer name as a string.

Correct fix

I have always recommended using the imprimirEnImpresora method instead of the end method to finish the print job, in this way you take care of saving the name of the printer and passing it to the plugin when printing.

So to fix this problem, don’t do this, this is wrong:

Do this, this is right:

The difference is that I am invoking imprimirEnImpresora by passing the printer name, and not just the end method.

Simple fix

Another solution is to simply invoke setImpresora. Most of the time this problem occurs because the client uses the free plugin and calls setImpresora correctly; It works for him and he buys the premium version, but when using the premium version he forgets to invoke setImpresora, so he gets the error sql: no rows in result set.

In short

You can do two things: invoke the setImpresora method again with the name of your printer, or start using the imprimirEnImpresora method instead of the end method.


I am available for hiring if you need help! I can help you with your project or homework feel free to contact me.
If you liked the post, show your appreciation by sharing it, or making a donation

Suscribir por correo

Ingresa tu correo y recibirás mis últimas entradas sobre programación, open source, bases de datos y todo lo relacionado con informática

Join 4,739 other subscribers


parzibyte

Freelancer programmer ready to work with you. Web, mobile and desktop applications. PHP, Java, Go, Python, JavaScript, Kotlin and more :) https://parzibyte.me/

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published.

%d bloggers like this: