Bug report #5610

MS SQL Server driver - Attribute table empty after using Query builder

Added by Carlos da Ponte over 7 years ago. Updated over 7 years ago.

Status:Closed
Priority:Normal
Assignee:Tamas Szekeres
Category:Data Provider/MSSQL
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:15183

Description

After using the MS SQL Server driver and the query builder to filter the imported layer/table, the attribute table is empty, noting at the top that that "0/0 features selected". If I then select a feature the attribute table remains empty. If I then remove the query, the attribute table repopulates.

This may be related but I was receiving the following error when using the query builder:

An error occurred when executing the query.
The data provider said:
[Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt QODBC3: Unable to execute statement

I identified that this only happened when I used the "Sample" button to return values associated with the selected field in the query builder form. I realized that this was the issue when I read this:

_This is caused by having an open result set open against the same connection. For example, you execute a SqlCommand to select all rows from a table, while the result set is not drained, you try to execute another SqlCommand using the same connection, you will hit this error message.

To solve this, you have two choices:
a. Make sure you read the rest data from the pending result set before you send the next SqlCommand.
b. Use MARS (Multiple Active ResultSet) connection setting to enable multiple active result set in a connection. See http://msdn2.microsoft.com/en-us/library/ms345109.aspx
for more details.

_

Thanks!
Carlos

Associated revisions

Revision 2519df85
Added by Tamas Szekeres over 7 years ago

MSSQL provider: Implement minimumValue, maximumValue and uniqueValues (fixes #5610)

History

#1 Updated by Tamas Szekeres over 7 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF