New topic: SQLPreparedStatement not finding empty text fields
<http://forums.realsoftware.com/viewtopic.php?t=45331> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message JimPitchford Post subject: SQLPreparedStatement not finding empty text fieldsPosted: Wed Sep 12, 2012 6:49 pm Joined: Mon Apr 11, 2011 2:01 pm Posts: 107 I can't seem to get the SQLPreparedStatements to handle empty text fields. By way of an example I've modified the code in the RealStudio Database example to add an additional bevelbutton with the following code: Dim ps As REALSQLPreparedStatement // Because the Orders database was added to the project, you // have to cast the result from the Prepare method to REALSQLPreparedStatement. ps = REALSQLPreparedStatement(Orders.Prepare("SELECT * FROM Customers WHERE Fax = ? ")) // have to tell sqlite what types the items being bound are so it does the right thing ps.BindType(0, REALSQLPreparedStatement.SQLITE_TEXT) ps.Bind(0, "") // Search for any empty fax address // perform the search Dim rs As RecordSet = ps.SQLSelect If rs <> Nil Then ResultsList.DeleteAllRows ResultsList.ColumnCount = rs.FieldCount ResultsList.HasHeading = True Dim hasHeadings As Boolean While rs.EOF <> True ResultsList.AddRow("") For i As Integer = 0 To rs.fieldcount-1 If Not hasheadings Then ResultsList.Heading(i) = rs.IdxField(i+1).Name ResultsList.Cell(ResultsList.LastIndex, i) = rs.IdxField(i+1).StringValue Next rs.MoveNext hasHeadings = True Wend rs.Close Else If Orders.Error Then MsgBox(Orders.ErrorMessage) End If It should find the 2 customers with empty fax addresses, but it finds nothing. It works OK with normal SQL Select statements - why not preparedStatements? Jim _________________ Jim OSX 10.8.1, rb2012r1 Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
