<?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[Übergabe einer Datei an eine Access DB]]></title><description><![CDATA[<p>Hi @ all,</p>
<p>ich versauche eine Datei in eine Acces Datenbank zu schreiben.<br />
Diese soll in einem Image(BLOB) Feld abgeelgt werden.<br />
ich versuche es auf folgende Weise und bekomme ständig einen unbekannten Fehler.</p>
<pre><code class="language-cpp">LPSTREAM lpStr = NULL;
COleStreamFile osFile;
CString strPath = &quot;C:\\NoRA\\noradat\\00000001.doc&quot;;
osFile.Open(strPath, COleStreamFile::modeRead | COleStreamFile::typeBinary     
     | COleStreamFile::shareDenyWrite); 
osFile.CreateMemoryStream();
lpStr = osFile.GetStream();
//Datenbankfelder 
db.m_id = 1; // long
lstrcpy(db.m_name, &quot;Karsten&quot;); // 
TCHARdb.m_bin = lpStr; //ISequentialStream*

HRESULT hRes;
hRes = db.Insert();
if(FAILED(hRes))	
     AfxThrowOleException(hRes); //Unbekannter Fehler
</code></pre>
<p>Was mache ich falsch?</p>
<p>Gruß<br />
Karsten</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/153640/übergabe-einer-datei-an-eine-access-db</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Jul 2026 09:51:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/153640.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 Jul 2006 10:25:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Übergabe einer Datei an eine Access DB on Wed, 19 Jul 2006 10:25:45 GMT]]></title><description><![CDATA[<p>Hi @ all,</p>
<p>ich versauche eine Datei in eine Acces Datenbank zu schreiben.<br />
Diese soll in einem Image(BLOB) Feld abgeelgt werden.<br />
ich versuche es auf folgende Weise und bekomme ständig einen unbekannten Fehler.</p>
<pre><code class="language-cpp">LPSTREAM lpStr = NULL;
COleStreamFile osFile;
CString strPath = &quot;C:\\NoRA\\noradat\\00000001.doc&quot;;
osFile.Open(strPath, COleStreamFile::modeRead | COleStreamFile::typeBinary     
     | COleStreamFile::shareDenyWrite); 
osFile.CreateMemoryStream();
lpStr = osFile.GetStream();
//Datenbankfelder 
db.m_id = 1; // long
lstrcpy(db.m_name, &quot;Karsten&quot;); // 
TCHARdb.m_bin = lpStr; //ISequentialStream*

HRESULT hRes;
hRes = db.Insert();
if(FAILED(hRes))	
     AfxThrowOleException(hRes); //Unbekannter Fehler
</code></pre>
<p>Was mache ich falsch?</p>
<p>Gruß<br />
Karsten</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1100278</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1100278</guid><dc:creator><![CDATA[CrazyPlaya]]></dc:creator><pubDate>Wed, 19 Jul 2006 10:25:45 GMT</pubDate></item><item><title><![CDATA[Reply to Übergabe einer Datei an eine Access DB on Wed, 19 Jul 2006 11:11:17 GMT]]></title><description><![CDATA[<p>Grmbl...</p>
<p>Ich habe schon mal nach dem hRes gefragt! Was passiert denn nun?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1100301</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1100301</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Wed, 19 Jul 2006 11:11:17 GMT</pubDate></item><item><title><![CDATA[Reply to Übergabe einer Datei an eine Access DB on Wed, 19 Jul 2006 11:34:17 GMT]]></title><description><![CDATA[<p>hRes gibt Unbekannter Fehler aus.<br />
Wenn ich es mit anderen Feldern in der DB mache ist alles kein Problem z.B. char und int oder auch datetime. Läuft wunderbar.</p>
<p>Es muss an dem Stream liegen.</p>
<p>Aber was ich da falsch mache K.A.<br />
Ich habe bisher noch nie mit Streams gearbeitet wenn ich Daten an eine Datenbanktabelle übergeben muss.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1100318</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1100318</guid><dc:creator><![CDATA[CrazyPlaya]]></dc:creator><pubDate>Wed, 19 Jul 2006 11:34:17 GMT</pubDate></item><item><title><![CDATA[Reply to Übergabe einer Datei an eine Access DB on Thu, 20 Jul 2006 08:36:46 GMT]]></title><description><![CDATA[<p>So nun habe ich festgestellt, dass das so wie oben nicht richtig funktioniert mit dem Stream.<br />
Habe es nun mal ganz so gemacht wie es sein sollte, kann den Stream aber dennoch nicht übergeben.</p>
<pre><code class="language-cpp">h = ::FindFirstFile(strPath, &amp;fData);
if(h == (HANDLE)0xFFFFFFFF)
{     
   AfxMessageBox(&quot;Verzeichnis nicht gefunden&quot;);
   return;
}
do
{     
  if(!::FindNextFile(h, &amp;fData)) 
  {        
     nStop = 0;
  }
}while(strcmp(fData.cFileName, strFileName) != 0 &amp;&amp; nStop != 0);
if(nStop != 0)
{	     
   VERIFY(::StgCreateDocfile(T2COLE(g_szRootStorageName), STGM_READWRITE |  
     STGM_SHARE_EXCLUSIVE | STGM_CREATE,0, &amp;pStg) == S_OK); 
   VERIFY(pStg-&gt;CreateStorage(T2COLE(szStorageName), STGM_CREATE | 
      STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0,0, &amp;pStgFile)== S_OK); 
   strcpy(szStreamName, fData.cFileName);

   VERIFY(pStg-&gt;CreateStream(T2COLE(szStreamName), STGM_CREATE |             
   STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0,0, &amp;lpStr) == S_OK);
}
db.m_id = 1;
lstrcpy(db.m_name, &quot;Karsten&quot;);
db.m_bin = lpStr;
hRes = db.Insert();
if(FAILED(hRes))     
  AfxThrowOleException(hRes); //Nun bekomme ich 
        //allerdings &quot;Interner   
        //Anwendungsfehler zurück
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1100846</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1100846</guid><dc:creator><![CDATA[CrazyPlaya]]></dc:creator><pubDate>Thu, 20 Jul 2006 08:36:46 GMT</pubDate></item></channel></rss>