﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » Using BO.Seek with strings and single quotes</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 14:18:57 GMT</lastBuildDate><ttl>20</ttl><item><title>Using BO.Seek with strings and single quotes</title><link>http://forum.strataframe.net/FindPost31530.aspx</link><description>I have a variable called myName and its value is --&amp;gt;&amp;nbsp; Paddy O'Sullivan&lt;br/&gt;&lt;br/&gt;I have a MyBo.seek("Comp_name = " + "'"&amp;nbsp; + myName&amp;nbsp;&amp;nbsp; + "'") and its erroring out, I think &amp;nbsp;because of the embedded single quote in the name before Sullivan&lt;br/&gt;&lt;br/&gt;(If I was doing this in SQL (as opposed to a BO) I'd use a Parameter so single quotes would not be a problem)&lt;br/&gt;&lt;br/&gt;I know I cam probably get over this by replacing single quotes with adifferent character but I wont get a proper result then. &lt;br/&gt;&lt;br/&gt;Is there any way of using e Parameter structure when I do BO.Seek ?</description><pubDate>Tue, 30 Oct 2012 04:01:22 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Using BO.Seek with strings and single quotes</title><link>http://forum.strataframe.net/FindPost31536.aspx</link><description>Hi Ivan, Edhy, many thanks for your replies.&lt;br/&gt;&lt;br/&gt;Since posting , I have discovered that doing a seek on a BO.Seek &amp;nbsp;is too slow (With thousands of transactions) so I have gone back to Seeking the Database itself, and here I can use parameters anyway, so not a problem&lt;br/&gt;&lt;br/&gt;Just one query though, If I do as seek with the replaced two single&amp;nbsp;quotes, does it seek for the Single Quote or seek for two single quotes&lt;br/&gt;&lt;br/&gt;In an example, I used a variable to hold the string (with the single quote replaced with two single quotes) , and if it was not&amp;nbsp;found, it inserts it, but it inserted two single quotes&amp;nbsp;!!</description><pubDate>Tue, 30 Oct 2012 04:01:22 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Using BO.Seek with strings and single quotes</title><link>http://forum.strataframe.net/FindPost31535.aspx</link><description>Yep, looks good. &lt;span&gt;;)&lt;/span&gt;</description><pubDate>Mon, 29 Oct 2012 13:57:33 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: Using BO.Seek with strings and single quotes</title><link>http://forum.strataframe.net/FindPost31534.aspx</link><description>Hi Ger, Ivan,&lt;br/&gt;&lt;br/&gt;Since no parameter can be used in the bo.Seek() I am a big fan of using the String.Format to get my expression clearer, so I would use something like this:&lt;br/&gt;&lt;span&gt;[codesnippet]&lt;/span&gt;&lt;span style="color:blue;"&gt;Me&lt;/span&gt;.MyBO.Seek(&lt;span style="color:blue;"&gt;String&lt;/span&gt;.Format(&lt;span style="color:#a31515;"&gt;"MyName='{0}'"&lt;/span&gt;,&amp;nbsp;&lt;span style="color:blue;"&gt;Me&lt;/span&gt;.MyBO.&lt;span style="color:#a31515;"&gt;MyName&lt;/span&gt;.Replace(&lt;span style="color:#a31515;"&gt;"'"&lt;/span&gt;,&amp;nbsp;&lt;span style="color:#a31515;"&gt;"''"&lt;/span&gt;)))&lt;span&gt;[/codesnippet]&lt;/span&gt;</description><pubDate>Mon, 29 Oct 2012 09:31:42 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Using BO.Seek with strings and single quotes</title><link>http://forum.strataframe.net/FindPost31532.aspx</link><description>Hi Ger.&lt;br/&gt;&lt;br/&gt;Try:&lt;br/&gt;&lt;br/&gt;&lt;span&gt;[codesnippet]&lt;/span&gt;&lt;span&gt;MyBo.seek("Comp_name = " + "'"&amp;nbsp; + myName.Replace("'", "''")&amp;nbsp; + "'")[/codesnippet]&lt;/span&gt;</description><pubDate>Mon, 29 Oct 2012 06:24:29 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item></channel></rss>