sql - SqlCeReader hangs when query returns 0 rows -


I am developing for Windows Mobile 6.5, SQL compact version 3.5 SP2 (3.5.1, aka 3.5) .8080.0) with

When my query is Net> 1 result, reader.Read () returns the required non-zero values ​​( while the loop allows to move forward ). But if there are no match data in the table, and 0 rows back in the query results, then call the call to reader.Read () indefinitely, on the contrary, that I Returned to 0, leaving while loop.

  SqlCeCommand cmd = mValidationDB.CreateCommand (); Cmd.CommandText = String.Format ("Choose from where validation partCode = '{0}' or CLEI = '{0}'", barcode); SqlCeDataReader Reader = cmd.ExecuteReader (); While (reader.Read ()) {string result = reader.GetString (0); Return result; } Return "";  

Any sign that I am doing wrong here?


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -