MSSQLServerDatabase Error 48879

We have created a WebApp that uses MS SQL Server as it’s database. We have been slowly adding more users to the app. Recently we have received the following database error a few times.

Error number: 48879
Error message: A query is already in progress

The App was trying to do an SQL Update when the db error was received the error. We are opening the database in the Session.Open and the MSSQLServerDatabase is a property of the App. Any suggestions on keeping this from happening would be greatly appreciated.

Also, I have a question concerning using commits with MSSQLServerDatabase. Are they only necessary when you use “BEGIN TRANSACTION”? Say you are doing a simple SQL Update, would it be necessary to issue a commit?

Thanks!

Consider moving the MSSQLServerDatabase property from WebApplication to WebSession so there is a unique instance for each user. Note the Databases section near the bottom of the WebSession documentation.

Commit is to be paired with Begin Transaction. When to use Database Transactions is described reasonably well here.

If you’re not already using Prepared Statements with user supplied data, consider doing so to avoid SQL Injection attacks.

Thanks Federick!

I believe you hit the nail on the head. We looked at Sessions in the help previously, but missed the part on databases in the websession. We will definitely implement all of your suggestions and thanks for explaining the database transactions better.

Thanks again.