<?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[Anzahl der Datensätze mit MySQLDac]]></title><description><![CDATA[<p>Nabend,</p>
<p>ich mitt mittels der MySQLDac Komponenten prüfen ob ein spezieller Datensatz existiert und je nachdem eine Variable auf true bzw. false setzen.</p>
<p>Leider will das nicht so ganz, daher lasse ich mir in einem Memo weitere Daten ausgeben. Im Memo wird immer insert angezeigt, auch wenn die datensatz bereits existiert.</p>
<pre><code class="language-cpp">String sql = &quot;select count(*) as anzahl from products_data where uniqueid = '&quot;+ AnsiString(dbuniqueid) +&quot;'&quot;;
   bool found = false;

try
{
   Form1-&gt;SQLQuery-&gt;Close();
   Form1-&gt;SQLQuery-&gt;SQL-&gt;Clear();
   Form1-&gt;SQLQuery-&gt;SQL-&gt;Add(sql);
   Form1-&gt;SQLQuery-&gt;Open();

   if (Form1-&gt;SQLQuery-&gt;RowsAffected == 0)
   {
      found = false;
      Form1-&gt;Memo1-&gt;Lines-&gt;Add(&quot;insert&quot;);
   }
   else
   {
      found = true;
      Form1-&gt;Memo1-&gt;Lines-&gt;Add(&quot;update&quot;);
   }
    Form1-&gt;SQLQuery-&gt;Close();
}
catch(...)
{
   found = false;
   Form1-&gt;Memo1-&gt;Lines-&gt;Add(&quot;Error&quot;);
}
</code></pre>
<p>Das Problem müsste in der Zeile<br />
if (Form1-&gt;SQLQuery-&gt;RowsAffected == 0)<br />
liegen.</p>
<p>Weiß jemand was daran falsch ist?</p>
<p>Hannes</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/99746/anzahl-der-datensätze-mit-mysqldac</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Jul 2026 04:33:30 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/99746.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 31 Jan 2005 13:46:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Anzahl der Datensätze mit MySQLDac on Mon, 31 Jan 2005 13:46:03 GMT]]></title><description><![CDATA[<p>Nabend,</p>
<p>ich mitt mittels der MySQLDac Komponenten prüfen ob ein spezieller Datensatz existiert und je nachdem eine Variable auf true bzw. false setzen.</p>
<p>Leider will das nicht so ganz, daher lasse ich mir in einem Memo weitere Daten ausgeben. Im Memo wird immer insert angezeigt, auch wenn die datensatz bereits existiert.</p>
<pre><code class="language-cpp">String sql = &quot;select count(*) as anzahl from products_data where uniqueid = '&quot;+ AnsiString(dbuniqueid) +&quot;'&quot;;
   bool found = false;

try
{
   Form1-&gt;SQLQuery-&gt;Close();
   Form1-&gt;SQLQuery-&gt;SQL-&gt;Clear();
   Form1-&gt;SQLQuery-&gt;SQL-&gt;Add(sql);
   Form1-&gt;SQLQuery-&gt;Open();

   if (Form1-&gt;SQLQuery-&gt;RowsAffected == 0)
   {
      found = false;
      Form1-&gt;Memo1-&gt;Lines-&gt;Add(&quot;insert&quot;);
   }
   else
   {
      found = true;
      Form1-&gt;Memo1-&gt;Lines-&gt;Add(&quot;update&quot;);
   }
    Form1-&gt;SQLQuery-&gt;Close();
}
catch(...)
{
   found = false;
   Form1-&gt;Memo1-&gt;Lines-&gt;Add(&quot;Error&quot;);
}
</code></pre>
<p>Das Problem müsste in der Zeile<br />
if (Form1-&gt;SQLQuery-&gt;RowsAffected == 0)<br />
liegen.</p>
<p>Weiß jemand was daran falsch ist?</p>
<p>Hannes</p>
]]></description><link>https://www.c-plusplus.net/forum/post/711191</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/711191</guid><dc:creator><![CDATA[Hannes Ker]]></dc:creator><pubDate>Mon, 31 Jan 2005 13:46:03 GMT</pubDate></item><item><title><![CDATA[Reply to Anzahl der Datensätze mit MySQLDac on Mon, 31 Jan 2005 13:57:48 GMT]]></title><description><![CDATA[<p>soweit ich weis gibt RowsAffected die Anzahl der Zeilen zurück die von einem Insert/Update/Delete Statement betroffen wurden.(Siehe BCB-Hilfe:RowsAffected zu der benutzten Komponente)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/711208</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/711208</guid><dc:creator><![CDATA[Beliah]]></dc:creator><pubDate>Mon, 31 Jan 2005 13:57:48 GMT</pubDate></item><item><title><![CDATA[Reply to Anzahl der Datensätze mit MySQLDac on Mon, 31 Jan 2005 14:07:14 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>wenn ich</p>
<p>if (Form1-&gt;SQLQuery-&gt;RecordCount == 0)</p>
<p>nutze, zeigt er immer nur update an, auch wenn datensätze noch nicht existieren.</p>
<p>ich verstehe das nicht.</p>
<p>hannes</p>
]]></description><link>https://www.c-plusplus.net/forum/post/711219</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/711219</guid><dc:creator><![CDATA[Hannes Ker]]></dc:creator><pubDate>Mon, 31 Jan 2005 14:07:14 GMT</pubDate></item><item><title><![CDATA[Reply to Anzahl der Datensätze mit MySQLDac on Mon, 31 Jan 2005 14:09:20 GMT]]></title><description><![CDATA[<p>Nicht alle DB / Treiber Kombinationen unterstützen RowCount. Versuch es mal mit dem guten alten FindFirst().</p>
]]></description><link>https://www.c-plusplus.net/forum/post/711223</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/711223</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 31 Jan 2005 14:09:20 GMT</pubDate></item><item><title><![CDATA[Reply to Anzahl der Datensätze mit MySQLDac on Mon, 31 Jan 2005 14:18:16 GMT]]></title><description><![CDATA[<p>hi,</p>
<p>if (Form1-&gt;SQLQuery-&gt;FindFirst() == false)</p>
<p>zeigt auch jedesmal update an <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>hannes</p>
]]></description><link>https://www.c-plusplus.net/forum/post/711234</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/711234</guid><dc:creator><![CDATA[Hannes Ker]]></dc:creator><pubDate>Mon, 31 Jan 2005 14:18:16 GMT</pubDate></item><item><title><![CDATA[Reply to Anzahl der Datensätze mit MySQLDac on Mon, 31 Jan 2005 18:39:59 GMT]]></title><description><![CDATA[<p>hi,</p>
<p>problem liegt daran das count(*) as anzahl nicht geht, habe es durch * ersetzt <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>hannes</p>
]]></description><link>https://www.c-plusplus.net/forum/post/711491</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/711491</guid><dc:creator><![CDATA[Hannes Ker]]></dc:creator><pubDate>Mon, 31 Jan 2005 18:39:59 GMT</pubDate></item></channel></rss>