<?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[ADO umlaute]]></title><description><![CDATA[<p>Hallo Leute</p>
<p>habe mir eine ADO Klasse geschrieben. Dieser Verbindet auf einen MS SQL 2005. Leider bekomme ich bei Spalten mit Text keine Umlaute zurück. Lediglich Fragezeichen.<br />
Ein Auszug aus der Executefunktion.<br />
Dies wird in einer DLL ausgeführt.<br />
Ersuche bitte um hilfe.<br />
Danke</p>
<pre><code class="language-cpp">AFX_MANAGE_STATE(AfxGetStaticModuleState());

	m_ulAffectedRows = 0;

	try
	{
		// Prepare the recordset object
		if ( result == NULL )
		{
			result.CreateInstance( __uuidof( ADODB::Recordset ) );
		}
		else
		{
			result-&gt;Close();
		}

		// Prepare the query
		ADODB::_CommandPtr		pCommand;
		pCommand.CreateInstance( __uuidof(ADODB::Command) );
		pCommand-&gt;PutCommandType( ADODB::adCmdText );
		pCommand-&gt;PutCommandText( _bstr_t( sqlcommando ) );
		pCommand-&gt;PutActiveConnection( LPDISPATCH( conn ) );
		pCommand-&gt;PutPrepared( true );

		// Execute the query
		_variant_t		varRowsAffected;

		ADODB::_RecordsetPtr resulttemp = pCommand-&gt;Execute( &amp;varRowsAffected, NULL, 0 );

		m_ulAffectedRows = int( varRowsAffected ) &gt;= 0 ? ( unsigned long( varRowsAffected ) ) : 0;

		ADODB::FieldsPtr	theFields = resulttemp-&gt;GetFields();
		if ( !theFields || theFields-&gt;GetCount() &lt;= 0 )
		{
			/*	Statement executed */

//			sqlexecute( &quot;SELECT @@IDENTITY&quot;);
			m_lastinsertid = field[1];

			return DB_COMMAND_OK;
		}

		m_fields.RemoveAll();

		result = resulttemp;

		if ( result-&gt;Get_EOF() )
		{
			/*  Keine Daten vorhanden */
			return DB_EMPTY_QUERY;
		}

		for ( long colNum = 1; colNum &lt;= theFields-&gt;GetCount(); colNum++ )
		{
			ADODB::FieldPtr		theField;
			theFields-&gt;get_Item( _variant_t( colNum - 1 ), &amp;theField );

			_variant_t			theValue;
			if ( theField )
			{
				theField-&gt;get_Value( &amp;theValue );
			}

			if( theValue.vt != VT_EMPTY &amp;&amp; theValue.vt != VT_NULL )
			theValue.ChangeType( VT_BSTR );

			if( theValue.vt == VT_EMPTY || theValue.vt == VT_NULL )
			{
				m_fields.Add( NULL );

			}
			else
			{
				m_fields.Add( (LPCTSTR)theValue.bstrVal );
			}	
		}
	}
	catch( _com_error&amp; e )
	{
		m_errorMessage = errorMessage( e );

		if ( result )
		{
			result.Release();
		}

		return DB_COMMAND_ERROR;
	}

	return DB_SELECT_OK;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/177679/ado-umlaute</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 15:24:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/177679.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 02 Apr 2007 22:18:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ADO umlaute on Mon, 02 Apr 2007 22:18:17 GMT]]></title><description><![CDATA[<p>Hallo Leute</p>
<p>habe mir eine ADO Klasse geschrieben. Dieser Verbindet auf einen MS SQL 2005. Leider bekomme ich bei Spalten mit Text keine Umlaute zurück. Lediglich Fragezeichen.<br />
Ein Auszug aus der Executefunktion.<br />
Dies wird in einer DLL ausgeführt.<br />
Ersuche bitte um hilfe.<br />
Danke</p>
<pre><code class="language-cpp">AFX_MANAGE_STATE(AfxGetStaticModuleState());

	m_ulAffectedRows = 0;

	try
	{
		// Prepare the recordset object
		if ( result == NULL )
		{
			result.CreateInstance( __uuidof( ADODB::Recordset ) );
		}
		else
		{
			result-&gt;Close();
		}

		// Prepare the query
		ADODB::_CommandPtr		pCommand;
		pCommand.CreateInstance( __uuidof(ADODB::Command) );
		pCommand-&gt;PutCommandType( ADODB::adCmdText );
		pCommand-&gt;PutCommandText( _bstr_t( sqlcommando ) );
		pCommand-&gt;PutActiveConnection( LPDISPATCH( conn ) );
		pCommand-&gt;PutPrepared( true );

		// Execute the query
		_variant_t		varRowsAffected;

		ADODB::_RecordsetPtr resulttemp = pCommand-&gt;Execute( &amp;varRowsAffected, NULL, 0 );

		m_ulAffectedRows = int( varRowsAffected ) &gt;= 0 ? ( unsigned long( varRowsAffected ) ) : 0;

		ADODB::FieldsPtr	theFields = resulttemp-&gt;GetFields();
		if ( !theFields || theFields-&gt;GetCount() &lt;= 0 )
		{
			/*	Statement executed */

//			sqlexecute( &quot;SELECT @@IDENTITY&quot;);
			m_lastinsertid = field[1];

			return DB_COMMAND_OK;
		}

		m_fields.RemoveAll();

		result = resulttemp;

		if ( result-&gt;Get_EOF() )
		{
			/*  Keine Daten vorhanden */
			return DB_EMPTY_QUERY;
		}

		for ( long colNum = 1; colNum &lt;= theFields-&gt;GetCount(); colNum++ )
		{
			ADODB::FieldPtr		theField;
			theFields-&gt;get_Item( _variant_t( colNum - 1 ), &amp;theField );

			_variant_t			theValue;
			if ( theField )
			{
				theField-&gt;get_Value( &amp;theValue );
			}

			if( theValue.vt != VT_EMPTY &amp;&amp; theValue.vt != VT_NULL )
			theValue.ChangeType( VT_BSTR );

			if( theValue.vt == VT_EMPTY || theValue.vt == VT_NULL )
			{
				m_fields.Add( NULL );

			}
			else
			{
				m_fields.Add( (LPCTSTR)theValue.bstrVal );
			}	
		}
	}
	catch( _com_error&amp; e )
	{
		m_errorMessage = errorMessage( e );

		if ( result )
		{
			result.Release();
		}

		return DB_COMMAND_ERROR;
	}

	return DB_SELECT_OK;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1258229</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258229</guid><dc:creator><![CDATA[adohilfe]]></dc:creator><pubDate>Mon, 02 Apr 2007 22:18:17 GMT</pubDate></item><item><title><![CDATA[Reply to ADO umlaute on Tue, 03 Apr 2007 06:23:58 GMT]]></title><description><![CDATA[<p>Ich vermute mal, Dein Programm ist nicht mit Unicoder erzeugt!<br />
Also kannst Du doch einen BSTR nicht einfach zu einem LPCTSTR casten!</p>
<pre><code class="language-cpp">m_fields.Add( (LPCTSTR)theValue.bstrVal );
</code></pre>
<p>Korrekt ist:</p>
<pre><code class="language-cpp">m_fields.Add(CW2T(theValue.bstrVal));
</code></pre>
<p>Oder USES_CONVERSION, W2T...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258299</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258299</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Tue, 03 Apr 2007 06:23:58 GMT</pubDate></item><item><title><![CDATA[Reply to ADO umlaute on Tue, 03 Apr 2007 07:17:46 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Der Fehler ist schon bei</p>
<p>theField-&gt;get_Value( &amp;theValue );</p>
<p>im Variant sind die Umlaute und Sonderzeichen schon nicht vorhanden.<br />
Es liegt übrigens nicht an der Tatsache das die Klasse in einer LIB/DLL ist. Habe es auch ohne versucht.<br />
Habe es auch mit UNICODE versucht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258322</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258322</guid><dc:creator><![CDATA[adohilfe]]></dc:creator><pubDate>Tue, 03 Apr 2007 07:17:46 GMT</pubDate></item><item><title><![CDATA[Reply to ADO umlaute on Sat, 07 Apr 2007 05:44:18 GMT]]></title><description><![CDATA[<p>Habs gelöst.</p>
<p>Problem war das MSSQL mit einer anderen Sortiersprache gearbeitet hat.<br />
In ADO sind die Umlaute zwar noch immer weg (VARIANT) aber beim kopieren der Daten in den CString sind sie dann da.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1261027</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1261027</guid><dc:creator><![CDATA[adohilfe]]></dc:creator><pubDate>Sat, 07 Apr 2007 05:44:18 GMT</pubDate></item></channel></rss>