<?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[Fehler beim schreiben auf MS-Access Datenbank mittels OleDb]]></title><description><![CDATA[<p>Hallo, ich habe ein Access-Datenbank mit einen Primärschlüssel gesetzt auf (Auto)Increment.</p>
<pre><code class="language-cpp">CTable&lt;CDynamicAccessor&gt; rs; 

CDBPropSet propset(DBPROPSET_ROWSET); 
propset.AddProperty(DBPROP_IRowsetChange, true); 
propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE); 

HRESULT hr=rs.Open(session, szTableName, &amp;propset, 1); 
//hr is ok 

bool bRet; 
bRet=rs.SetStatus((ULONG)1, DBSTATUS_S_ISNULL);  //primärschlüssel 
UINT val=2; 
bRet=rs.SetValue(((ULONG)2, (UINT*)val);         //setze col=2 

hr=rs.Insert();                                   
if(FAILED(hr)) 
{ 
  // kein fehler aber DB_S_ERRORSOCCURRED 
} 

//Ergebnis DB_S_ERRORSOCCURRED, schauen wir mal 

//An error occurred while returning data for one or more columns, 
//but data was successfully returned for at least one column 

DBSTATUS status; 
rs.GetStatus(((ULONG)0, &amp;status);          //DBSTATUS_E_INTEGRITYVIOLATION 
rs.GetStatus(((ULONG)1, &amp;status);          //DBSTATUS_E_INTEGRITYVIOLATION  
C/C++ Code: 
CTable&lt;CDynamicAccessor&gt; rs; 

CDBPropSet propset(DBPROPSET_ROWSET); 
propset.AddProperty(DBPROP_IRowsetChange, true); 
propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE); 

HRESULT hr=rs.Open(session, szTableName, &amp;propset, 1); 
//hr is ok 

bool bRet; 
bRet=rs.SetStatus((ULONG)1, DBSTATUS_S_ISNULL); //primärschlüssel 
UINT val=2; 
bRet=rs.SetValue(((ULONG)2, (UINT*)val); //setze col=2 

hr=rs.Insert(); 
if(FAILED(hr)) 
{ 
// kein fehler aber DB_S_ERRORSOCCURRED 
} 

//Ergebnis DB_S_ERRORSOCCURRED, schauen wir mal 

//An error occurred while returning data for one or more columns, 
//but data was successfully returned for at least one column 

DBSTATUS status; 
rs.GetStatus(((ULONG)0, &amp;status); //DBSTATUS_E_INTEGRITYVIOLATION 
rs.GetStatus(((ULONG)1, &amp;status); //DBSTATUS_E_INTEGRITYVIOLATION  
C/C++ Code: 
CTable&lt;CDynamicAccessor&gt; rs; 

CDBPropSet propset(DBPROPSET_ROWSET); 
propset.AddProperty(DBPROP_IRowsetChange, true); 
propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE); 

HRESULT hr=rs.Open(session, szTableName, &amp;propset, 1); 
//hr is ok 

bool bRet; 
bRet=rs.SetStatus((ULONG)1, DBSTATUS_S_ISNULL);  //primärschlüssel 
UINT val=2; 
bRet=rs.SetValue(((ULONG)2, (UINT*)val);         //setze col=2 

hr=rs.Insert();                                   
if(FAILED(hr)) 
{ 
  // kein fehler aber DB_S_ERRORSOCCURRED 
} 

//Ergebnis DB_S_ERRORSOCCURRED, schauen wir mal 

//An error occurred while returning data for one or more columns, 
//but data was successfully returned for at least one column 

DBSTATUS status; 
rs.GetStatus(((ULONG)0, &amp;status);          //DBSTATUS_E_INTEGRITYVIOLATION 
rs.GetStatus(((ULONG)1, &amp;status);          //DBSTATUS_E_INTEGRITYVIOLATION
</code></pre>
<p>Die Daten werden ordnungsgemäß geschrieben und der Primärschlüssel (Auto)<br />
Inrement wir auf einen neuen Wert gesetzt.</p>
<p>Meine Frage was ist DBSTATUS_E_INTEGRITYVIOLATION &quot;The data value violated an integrity constraint&quot;<br />
(das ist schon klar??) aber wie kann ich diese Fehlermeldung vermeiden.</p>
<p>Eigendlich sollte das Ergebnis S_OK sein.</p>
<p>Hat jemand von euch eine Idee?</p>
<p>Volker</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/68194/fehler-beim-schreiben-auf-ms-access-datenbank-mittels-oledb</link><generator>RSS for Node</generator><lastBuildDate>Sat, 06 Jun 2026 16:25:37 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/68194.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 15 Mar 2004 19:26:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fehler beim schreiben auf MS-Access Datenbank mittels OleDb on Mon, 15 Mar 2004 19:26:57 GMT]]></title><description><![CDATA[<p>Hallo, ich habe ein Access-Datenbank mit einen Primärschlüssel gesetzt auf (Auto)Increment.</p>
<pre><code class="language-cpp">CTable&lt;CDynamicAccessor&gt; rs; 

CDBPropSet propset(DBPROPSET_ROWSET); 
propset.AddProperty(DBPROP_IRowsetChange, true); 
propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE); 

HRESULT hr=rs.Open(session, szTableName, &amp;propset, 1); 
//hr is ok 

bool bRet; 
bRet=rs.SetStatus((ULONG)1, DBSTATUS_S_ISNULL);  //primärschlüssel 
UINT val=2; 
bRet=rs.SetValue(((ULONG)2, (UINT*)val);         //setze col=2 

hr=rs.Insert();                                   
if(FAILED(hr)) 
{ 
  // kein fehler aber DB_S_ERRORSOCCURRED 
} 

//Ergebnis DB_S_ERRORSOCCURRED, schauen wir mal 

//An error occurred while returning data for one or more columns, 
//but data was successfully returned for at least one column 

DBSTATUS status; 
rs.GetStatus(((ULONG)0, &amp;status);          //DBSTATUS_E_INTEGRITYVIOLATION 
rs.GetStatus(((ULONG)1, &amp;status);          //DBSTATUS_E_INTEGRITYVIOLATION  
C/C++ Code: 
CTable&lt;CDynamicAccessor&gt; rs; 

CDBPropSet propset(DBPROPSET_ROWSET); 
propset.AddProperty(DBPROP_IRowsetChange, true); 
propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE); 

HRESULT hr=rs.Open(session, szTableName, &amp;propset, 1); 
//hr is ok 

bool bRet; 
bRet=rs.SetStatus((ULONG)1, DBSTATUS_S_ISNULL); //primärschlüssel 
UINT val=2; 
bRet=rs.SetValue(((ULONG)2, (UINT*)val); //setze col=2 

hr=rs.Insert(); 
if(FAILED(hr)) 
{ 
// kein fehler aber DB_S_ERRORSOCCURRED 
} 

//Ergebnis DB_S_ERRORSOCCURRED, schauen wir mal 

//An error occurred while returning data for one or more columns, 
//but data was successfully returned for at least one column 

DBSTATUS status; 
rs.GetStatus(((ULONG)0, &amp;status); //DBSTATUS_E_INTEGRITYVIOLATION 
rs.GetStatus(((ULONG)1, &amp;status); //DBSTATUS_E_INTEGRITYVIOLATION  
C/C++ Code: 
CTable&lt;CDynamicAccessor&gt; rs; 

CDBPropSet propset(DBPROPSET_ROWSET); 
propset.AddProperty(DBPROP_IRowsetChange, true); 
propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE); 

HRESULT hr=rs.Open(session, szTableName, &amp;propset, 1); 
//hr is ok 

bool bRet; 
bRet=rs.SetStatus((ULONG)1, DBSTATUS_S_ISNULL);  //primärschlüssel 
UINT val=2; 
bRet=rs.SetValue(((ULONG)2, (UINT*)val);         //setze col=2 

hr=rs.Insert();                                   
if(FAILED(hr)) 
{ 
  // kein fehler aber DB_S_ERRORSOCCURRED 
} 

//Ergebnis DB_S_ERRORSOCCURRED, schauen wir mal 

//An error occurred while returning data for one or more columns, 
//but data was successfully returned for at least one column 

DBSTATUS status; 
rs.GetStatus(((ULONG)0, &amp;status);          //DBSTATUS_E_INTEGRITYVIOLATION 
rs.GetStatus(((ULONG)1, &amp;status);          //DBSTATUS_E_INTEGRITYVIOLATION
</code></pre>
<p>Die Daten werden ordnungsgemäß geschrieben und der Primärschlüssel (Auto)<br />
Inrement wir auf einen neuen Wert gesetzt.</p>
<p>Meine Frage was ist DBSTATUS_E_INTEGRITYVIOLATION &quot;The data value violated an integrity constraint&quot;<br />
(das ist schon klar??) aber wie kann ich diese Fehlermeldung vermeiden.</p>
<p>Eigendlich sollte das Ergebnis S_OK sein.</p>
<p>Hat jemand von euch eine Idee?</p>
<p>Volker</p>
]]></description><link>https://www.c-plusplus.net/forum/post/481253</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/481253</guid><dc:creator><![CDATA[vdittrich]]></dc:creator><pubDate>Mon, 15 Mar 2004 19:26:57 GMT</pubDate></item><item><title><![CDATA[Reply to Fehler beim schreiben auf MS-Access Datenbank mittels OleDb on Mon, 15 Mar 2004 19:44:03 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile.php?mode=viewprofile&amp;u=403" rel="nofollow">HumeSikkins</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=15" rel="nofollow">C++</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=1" rel="nofollow">MFC mit dem Visual C++</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/481265</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/481265</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Mon, 15 Mar 2004 19:44:03 GMT</pubDate></item><item><title><![CDATA[Reply to Fehler beim schreiben auf MS-Access Datenbank mittels OleDb on Mon, 15 Mar 2004 21:11:10 GMT]]></title><description><![CDATA[<p>Danke da stand ich schon drin. übrigens verwende ich WTL !!!</p>
<p>volker</p>
]]></description><link>https://www.c-plusplus.net/forum/post/481316</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/481316</guid><dc:creator><![CDATA[vdittrich]]></dc:creator><pubDate>Mon, 15 Mar 2004 21:11:10 GMT</pubDate></item></channel></rss>