<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Relaxed matching bei ADO &amp;amp; MySQL]]></title><description><![CDATA[<p>Gegeben sei eine Adressdatenbank mit einem Suchfeld. Gesucht werden soll mit relaxed matching von MySQL (&quot;nachname like %meier%&quot; liefer meier, ameier, bmeir etc.).</p>
<p>Folgender Code:</p>
<pre><code>Query  = &quot;SELECT &quot;;
        Query += &quot;haupt_id, neben_id, von_haupt_id, hauptname AS Kontakt, nachname AS Nachname, vorname AS Vorname, wohnort AS Wohnort, telefon AS Telefon &quot;;
        Query += &quot;FROM hauptkontakte, nebenadressen &quot;;
        Query += &quot;WHERE ( &quot;;
        Query += &quot;( &quot;;
        Query += &quot;(hauptkontakte.hauptname LIKE %:SUCHSTRING%) &quot;; /*OR &quot;;*/
        Query += &quot;(nebenadressen.nachname LIKE %:SUCHSTRING%) OR &quot;;
        Query += &quot;(nebenadressen.vorname LIKE %:SUCHSTRING%) OR &quot;;
        Query += &quot;(nebenadressen.bemerkungen LIKE %:SUCHSTRING%) OR &quot;;
        Query += &quot;(nebenadressen.schluesselwoerter LIKE %:SUCHSTRING%) &quot;;
        Query += &quot;) &quot;;
        Query += &quot;AND &quot;;
        Query += &quot;( &quot;;
        Query += &quot;(hauptkontakte.owner = :OWNER) AND &quot;;
        Query += &quot;(hauptkontakte.haupt_id = nebenadressen.von_haupt_id) &quot;;
        Query += &quot;) &quot;;
        Query += &quot;) &quot;;
        Query += &quot;ORDER BY hauptkontakte.hauptname, nebenadressen.nachname, nebenadressen.vorname ASC&quot;;

        ADODataSet_Main-&gt;CommandText = Query;

        ADODataSet_Main-&gt;Parameters-&gt;ParamByName(&quot;OWNER&quot;)-&gt;Value = Mainformular-&gt;Benutzer;
        ADODataSet_Main-&gt;Parameters-&gt;ParamByName(&quot;SUCHSTRING&quot;)-&gt;Value = Edit_Suchstring-&gt;Text;
</code></pre>
<p>Den Parameter OWNER kann ich hinzufügen, den Parameter SUCHSTRING hingegen nicht. Fehlermeldung: <strong>ADODataSet: Parameter 'SUCHSTRING' nicht gefunden</strong></p>
<p>Es anscheinend an den Prozentzeichen vor :SUCHSTRING. Die brauche ich aber, da sie am Anfang und Ende des Feldinhaltes das relaxed matching einschalten.</p>
<p>Was muß ich tun?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/194483/relaxed-matching-bei-ado-amp-mysql</link><generator>RSS for Node</generator><lastBuildDate>Tue, 18 Aug 2026 05:10:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/194483.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 07 Oct 2007 16:20:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Relaxed matching bei ADO &amp;amp; MySQL on Sun, 07 Oct 2007 16:20:13 GMT]]></title><description><![CDATA[<p>Gegeben sei eine Adressdatenbank mit einem Suchfeld. Gesucht werden soll mit relaxed matching von MySQL (&quot;nachname like %meier%&quot; liefer meier, ameier, bmeir etc.).</p>
<p>Folgender Code:</p>
<pre><code>Query  = &quot;SELECT &quot;;
        Query += &quot;haupt_id, neben_id, von_haupt_id, hauptname AS Kontakt, nachname AS Nachname, vorname AS Vorname, wohnort AS Wohnort, telefon AS Telefon &quot;;
        Query += &quot;FROM hauptkontakte, nebenadressen &quot;;
        Query += &quot;WHERE ( &quot;;
        Query += &quot;( &quot;;
        Query += &quot;(hauptkontakte.hauptname LIKE %:SUCHSTRING%) &quot;; /*OR &quot;;*/
        Query += &quot;(nebenadressen.nachname LIKE %:SUCHSTRING%) OR &quot;;
        Query += &quot;(nebenadressen.vorname LIKE %:SUCHSTRING%) OR &quot;;
        Query += &quot;(nebenadressen.bemerkungen LIKE %:SUCHSTRING%) OR &quot;;
        Query += &quot;(nebenadressen.schluesselwoerter LIKE %:SUCHSTRING%) &quot;;
        Query += &quot;) &quot;;
        Query += &quot;AND &quot;;
        Query += &quot;( &quot;;
        Query += &quot;(hauptkontakte.owner = :OWNER) AND &quot;;
        Query += &quot;(hauptkontakte.haupt_id = nebenadressen.von_haupt_id) &quot;;
        Query += &quot;) &quot;;
        Query += &quot;) &quot;;
        Query += &quot;ORDER BY hauptkontakte.hauptname, nebenadressen.nachname, nebenadressen.vorname ASC&quot;;

        ADODataSet_Main-&gt;CommandText = Query;

        ADODataSet_Main-&gt;Parameters-&gt;ParamByName(&quot;OWNER&quot;)-&gt;Value = Mainformular-&gt;Benutzer;
        ADODataSet_Main-&gt;Parameters-&gt;ParamByName(&quot;SUCHSTRING&quot;)-&gt;Value = Edit_Suchstring-&gt;Text;
</code></pre>
<p>Den Parameter OWNER kann ich hinzufügen, den Parameter SUCHSTRING hingegen nicht. Fehlermeldung: <strong>ADODataSet: Parameter 'SUCHSTRING' nicht gefunden</strong></p>
<p>Es anscheinend an den Prozentzeichen vor :SUCHSTRING. Die brauche ich aber, da sie am Anfang und Ende des Feldinhaltes das relaxed matching einschalten.</p>
<p>Was muß ich tun?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1379826</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1379826</guid><dc:creator><![CDATA[dondoedel0815]]></dc:creator><pubDate>Sun, 07 Oct 2007 16:20:13 GMT</pubDate></item><item><title><![CDATA[Reply to Relaxed matching bei ADO &amp;amp; MySQL on Sun, 07 Oct 2007 18:22:42 GMT]]></title><description><![CDATA[<p>Vielleicht setzt du den Code aus Zeile 23 ganz nach oben, damit der Wert aus dem<br />
Edit im Query-String vorhanden ist.</p>
<p>So kann die DB-Abfrage klappen, denke ich...</p>
<p>MfG kpeter</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1379968</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1379968</guid><dc:creator><![CDATA[kpeter]]></dc:creator><pubDate>Sun, 07 Oct 2007 18:22:42 GMT</pubDate></item><item><title><![CDATA[Reply to Relaxed matching bei ADO &amp;amp; MySQL on Sun, 07 Oct 2007 18:32:37 GMT]]></title><description><![CDATA[<p>Ich würde es mit</p>
<pre><code class="language-cpp">...-&gt;ParamByName(&quot;SUCHSTRING&quot;)-&gt;Value = &quot;%&quot; + Edit_Suchstring-&gt;Text + &quot;%&quot;;
</code></pre>
<p>versuchen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1379982</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1379982</guid><dc:creator><![CDATA[Jansen]]></dc:creator><pubDate>Sun, 07 Oct 2007 18:32:37 GMT</pubDate></item><item><title><![CDATA[Reply to Relaxed matching bei ADO &amp;amp; MySQL on Mon, 08 Oct 2007 09:14:44 GMT]]></title><description><![CDATA[<p>Fehler (mehrere) gefunden:</p>
<p>1. Als &quot;Altlast&quot; war OWNER als fester Parameter im ADODataSet eingetragen, daher kannte er nur den einen. Den habe ich rausgenommen, da die zur Laufzeit eingetragen werden.</p>
<p>2. Jansen lag richtig, ich muß die Prozentzeichen aus dem Query raus haben.</p>
<p>3. (und das Hauptproblem): Mehrfaches verwenden eines Parameters im Query ist anscheinend nicht zugelassen.</p>
<p>Ich habe das jetzt auf folgendes Code geändert und es funktioniert wie gewollt:</p>
<pre><code>WideString Query;
        AnsiString Suche;

        Suche = &quot;%&quot; + Edit_Suchstring-&gt;Text + &quot;%&quot;;

        ADODataSet_Main-&gt;Active = false;

        Query  = &quot;SELECT &quot;;
        Query += &quot;haupt_id, neben_id, von_haupt_id, hauptname AS Kontakt, nachname AS Nachname, vorname AS Vorname, wohnort AS Wohnort, telefon AS Telefon &quot;;
        Query += &quot;FROM hauptkontakte, nebenadressen &quot;;
        Query += &quot;WHERE ( &quot;;
        Query += &quot;( &quot;;
        Query += &quot;(hauptkontakte.hauptname LIKE :SUCHSTRING1) OR &quot;;
        Query += &quot;(nebenadressen.nachname LIKE :SUCHSTRING2) OR &quot;;
        Query += &quot;(nebenadressen.vorname LIKE :SUCHSTRING3) OR &quot;;
        Query += &quot;(nebenadressen.bemerkungen LIKE :SUCHSTRING4) OR &quot;;
        Query += &quot;(nebenadressen.schluesselwoerter LIKE :SUCHSTRING5) &quot;;
        Query += &quot;) &quot;;
        Query += &quot;AND &quot;;
        Query += &quot;( &quot;;
        Query += &quot;(hauptkontakte.owner = :OWNER) AND &quot;;
        Query += &quot;(hauptkontakte.haupt_id = nebenadressen.von_haupt_id) &quot;;
        Query += &quot;) &quot;;
        Query += &quot;) &quot;;
        Query += &quot;ORDER BY hauptkontakte.hauptname, nebenadressen.nachname, nebenadressen.vorname ASC&quot;;

        ADODataSet_Main-&gt;CommandText = Query;

        ADODataSet_Main-&gt;Parameters-&gt;ParamByName(&quot;OWNER&quot;)-&gt;Value = Mainformular-&gt;Benutzer;
        ADODataSet_Main-&gt;Parameters-&gt;ParamByName(&quot;SUCHSTRING1&quot;)-&gt;Value = Suche;
        ADODataSet_Main-&gt;Parameters-&gt;ParamByName(&quot;SUCHSTRING2&quot;)-&gt;Value = Suche;
        ADODataSet_Main-&gt;Parameters-&gt;ParamByName(&quot;SUCHSTRING3&quot;)-&gt;Value = Suche;
        ADODataSet_Main-&gt;Parameters-&gt;ParamByName(&quot;SUCHSTRING4&quot;)-&gt;Value = Suche;
        ADODataSet_Main-&gt;Parameters-&gt;ParamByName(&quot;SUCHSTRING5&quot;)-&gt;Value = Suche;

        ADODataSet_Main-&gt;Open();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1380290</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1380290</guid><dc:creator><![CDATA[dondoedel0815]]></dc:creator><pubDate>Mon, 08 Oct 2007 09:14:44 GMT</pubDate></item></channel></rss>