Thermal printer

Fix: Error en el servidor: sql: no rows in result set when using thermal printer plugin

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:

See the gist on github.

Do this, this is right:

See the gist on github.

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

parzibyte

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

Entradas recientes

Receipt designer for thermal printers – Free and open source

In the last months I have been working on a ticket designer to print on…

4 months hace

JavaScript: store and read files with the Origin Private File System

In this post you will learn how to use the Origin Private File System with…

7 months hace

JavaScript: download file with fetch

In this post you will learn how to download a file in the background using…

7 months hace

SQLite3 with vanilla JavaScript and OPFS – Hello world

In this post I will show you how to use SQLite3 directly in the web…

9 months hace

Python Thermal Printing: A Comprehensive Guide for Printing on Thermal Printers

In this tutorial, we'll explore how to effortlessly print receipts, invoices, and tickets on a…

10 months hace

Image printing on Thermal printer

When printing receipts on thermal printers (ESC POS) sometimes it is needed to print images…

10 months hace

Esta web usa cookies.