<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=33655&amp;view=findpost&amp;p=220526</guid>
        <pubDate>Thu, 10 Oct 2002 19:08:41 +0000</pubDate>
        <title>Драйвер ODBC не поддерживает динамических...</title>
        <link>https://forum.sources.ru/index.php?showtopic=33655&amp;view=findpost&amp;p=220526</link>
        <description><![CDATA[Dim0S: Re: Gurza<br>Спасибо за пример, я его сохраню :). Я попробовал через DAO, получилось. Мне всего-то надо было отредактировать записи. Мог бы, в принципе, и на SQL, да вот решил сделать с помощью MFC-ых классов. Но вот насчет переносимости проги на другие компы еще не знаю, будет ли там через DАО работать &nbsp;:-/.<br><br>Получилось после преобразования из ODBC вот что<br>CDaoDatabase &nbsp; &nbsp; &nbsp;KTSSettingDB;<br>COleVariant &nbsp; &nbsp; &nbsp;destination;<br>CString &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strConnect(_T(&quot;DSN=KTSSettingsDB;UID=;PWD=;&quot;));<br>CString &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strProperties, strPropertiesResult;<br>char &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;szPort[200];<br>// Коннектимся к базе<br>TRY<br>{<br> &nbsp; &nbsp; &nbsp;KTSSettingDB.Open(NULL, FALSE, FALSE, strConnect);<br> &nbsp; &nbsp; &nbsp;// Распределяем записи<br> &nbsp; &nbsp; &nbsp;CDaoRecordset recset(&amp;KTSSettingDB);<br> &nbsp; &nbsp; &nbsp;// подготовим запрос<br> &nbsp; &nbsp; &nbsp;wsprintf( szPort, <br> &nbsp; &nbsp; &nbsp;&quot;SELECT prop_rmod FROM realmoduls WHERE id_objects = \%d AND id_moduls = 7 AND parent_rmod = 0&quot;, ((CMainFrame*)(AfxGetApp()-&gt;m_pMainWnd))-&gt;m_nObjectSelID);<br><br> &nbsp; &nbsp; &nbsp;recset.Open(dbOpenDynaset, szPort);<br> &nbsp; &nbsp; &nbsp;recset.Move(0);<br> &nbsp; &nbsp; &nbsp;recset.Edit();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br> &nbsp; &nbsp; &nbsp;destination = recset.GetFieldValue(&quot;prop_rmod&quot;);<br> &nbsp; &nbsp; &nbsp;strProcProperties = destination.pbVal;<br> &nbsp; &nbsp; &nbsp;////////// <br> &nbsp; &nbsp; &nbsp;// здесь преобразование данных<br> &nbsp; &nbsp; &nbsp;////////////<br> &nbsp; &nbsp; &nbsp;<br> &nbsp; &nbsp; &nbsp;recset.SetFieldValue(&quot;prop_rmod&quot;, (LPCTSTR)strPropertiesResult);<br> &nbsp; &nbsp; &nbsp;recset.Update();<br> &nbsp; &nbsp; &nbsp;// Закрываем базу данных<br> &nbsp; &nbsp; &nbsp;recset.Close();<br> &nbsp; &nbsp; &nbsp;KTSSettingDB.Close(); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>}<br>CATCH(CDaoException, e)<br>{<br> &nbsp; &nbsp; &nbsp;// Открытие базы данных вызвало исключение, проще говоря ошибку...<br> &nbsp; &nbsp; &nbsp;AfxMessageBox(&quot;Database error: &quot; + e-&gt;m_pErrorInfo-&gt;m_strDescription);<br> &nbsp; &nbsp; &nbsp;KTSSettingDB.Close(); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br> &nbsp; &nbsp; &nbsp;return;<br>}<br>END_CATCH; &nbsp; &nbsp; &nbsp;<br><br>Небольшая проблемка только втом, что работаю с Мемо-полями, приходится производить кучу преобразований над строками. Но это решено. Так что всем спасибо за ответы :-)]]></description>
        <author>Dim0S</author>
        <category>C/C++: Базы данных</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=33655&amp;view=findpost&amp;p=220525</guid>
        <pubDate>Thu, 10 Oct 2002 09:47:18 +0000</pubDate>
        <title>Драйвер ODBC не поддерживает динамических...</title>
        <link>https://forum.sources.ru/index.php?showtopic=33655&amp;view=findpost&amp;p=220525</link>
        <description><![CDATA[Gurza: Для примера. Может чё почерпнёшь.<br><br><div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&#60;br&#62;// Получаем имя Excel-ODBC драйвера&#60;br&#62;CString CListXLSDlg::GetExcelDriver()&#60;br&#62;{&#60;br&#62;    char szBuf[2001];&#60;br&#62;    WORD cbBufMax = 2000;&#60;br&#62;    WORD cbBufOut;&#60;br&#62;    char *pszBuf = szBuf;&#60;br&#62;    CString sDriver = _T(&quot;&quot;);&#60;br&#62;&#60;br&#62;    // Получаем имена проинсталированных драйверов&#60;br&#62;    // (&quot;odbcinst.h&quot; должен быть включён в проект )&#60;br&#62;    if (!SQLGetInstalledDrivers(szBuf, cbBufMax, &amp;cbBufOut)) &#60;br&#62;            return sDriver;&#60;br&#62;    // Ищем драйвер...&#60;br&#62;    do&#60;br&#62;    {&#60;br&#62;        if (strstr(pszBuf, &quot;Excel&quot;) != 0)&#60;br&#62;        {   // Нашли !&#60;br&#62;            sDriver = CString(pszBuf); break;&#60;br&#62;        }&#60;br&#62;        pszBuf = strchr(pszBuf, &#39;{text}&#39;) + 1;&#60;br&#62;    }&#60;br&#62;    while (pszBuf[1] != &#39;{text}&#39;);&#60;br&#62;    return sDriver;&#60;br&#62;}</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br><br><div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&#60;br&#62;// Создаю файл Report.xls&#60;br&#62;&#60;br&#62;UINT CListXLSDlg::ListPatientsXLSThread()&#60;br&#62;{&#60;br&#62;   CDatabase database;&#60;br&#62;   CString sDriver = GetExcelDriver();// Название драйвера в ODBC менеджере&#60;br&#62;   if(!strlen(sDriver))&#60;br&#62;   {&#60;br&#62;      CString str;&#60;br&#62;      str.Format(_T(&quot;Драйвер для создания файла типа .XLS не установлен.&quot;));&#60;br&#62;      AfxMessageBox(str);&#60;br&#62;      return 0;&#60;br&#62;   }&#60;br&#62;   CString sExcelFile = m_sExcelPuth;     &#60;br&#62;   sExcelFile += _T(&quot;Report.xls&quot;);&#60;br&#62;   CString sSql = _T(&quot;&quot;);&#60;br&#62;   CFileFind   fFindfile;&#60;br&#62;   if(fFindfile.FindFile(sExcelFile)) ::DeleteFile(sExcelFile);&#60;br&#62;   TRY {&#60;br&#62;      // Формируем строку для доступа минуя DSN&#60;br&#62;         sSql .Format(_T(&quot;DRIVER={\%s}; DSN=&#39;&#39;; FIRSTROWHASNAMES=1; READONLY=FALSE; CREATE_DB=\&quot;\%s\&quot;; DBQ=\%s&quot;), sDriver, sExcelFile, sExcelFile);&#60;br&#62;      // Создаём таблуцу Excel&#60;br&#62;      if( database.OpenEx(sSql, CDatabase::noOdbcDialog) ) {&#60;br&#62;         // Создаём структуру таблицы&#60;br&#62;         // .......... //&#60;br&#62;         database.Close();&#60;br&#62;      }      &#60;br&#62;   }&#60;br&#62;   CATCH_ALL(e) {&#60;br&#62;      database.Close();&#60;br&#62;      e-&#62;Delete();&#60;br&#62;      AfxMessageBox(_T(&quot;Ошибка при внесении данных.&quot;));&#60;br&#62;   }&#60;br&#62;   END_CATCH_ALL;&#60;br&#62;   m_editResult.SetWindowText(_T(&quot;Процесс завершен&quot;));&#60;br&#62;   return 0;&#60;br&#62;}&#60;br&#62;</div></ol></div></div></div></div><br><br><br><br><br>]]></description>
        <author>Gurza</author>
        <category>C/C++: Базы данных</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=33655&amp;view=findpost&amp;p=220524</guid>
        <pubDate>Thu, 10 Oct 2002 08:58:56 +0000</pubDate>
        <title>Драйвер ODBC не поддерживает динамических...</title>
        <link>https://forum.sources.ru/index.php?showtopic=33655&amp;view=findpost&amp;p=220524</link>
        <description><![CDATA[MikeR: А если попробовать напрямую обращаться к ODBC (через ф-ции Sql... )?<br>MFC, на мой взгляд, годится только для работы с окнами.]]></description>
        <author>MikeR</author>
        <category>C/C++: Базы данных</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=33655&amp;view=findpost&amp;p=220523</guid>
        <pubDate>Wed, 09 Oct 2002 17:20:28 +0000</pubDate>
        <title>Драйвер ODBC не поддерживает динамических...</title>
        <link>https://forum.sources.ru/index.php?showtopic=33655&amp;view=findpost&amp;p=220523</link>
        <description><![CDATA[Dim0S: Поставил MDAC 2.7, все равно пишет то же самое.<br>В запросе все верно, т.к. этот же запрос использую для чтения, и работает.<br><br>Насчет CRecordset. Пробовал и им, наследовал, и т.д. Дело не в CODBCRecordset.<br>А чем DAO лучше ODBC? Почему-то смотрю, и вижу, что все его чураются :).]]></description>
        <author>Dim0S</author>
        <category>C/C++: Базы данных</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=33655&amp;view=findpost&amp;p=220522</guid>
        <pubDate>Wed, 09 Oct 2002 07:31:24 +0000</pubDate>
        <title>Драйвер ODBC не поддерживает динамических...</title>
        <link>https://forum.sources.ru/index.php?showtopic=33655&amp;view=findpost&amp;p=220522</link>
        <description><![CDATA[-Sman-: :D<br>CODBCRecordset?<br>ты б просто CRecordset'ом попробовал...<br>эт могут быть недоработки одбц...<br>хотя с фокспро проблем такого плана не было (ток если по запарке открывал уже открытую базу - вываливались всякие разные сообщения - каждый раз разные &nbsp;;D)<br>а ваще - лучше Dao пользоваться - гибче и быстрее..]]></description>
        <author>-Sman-</author>
        <category>C/C++: Базы данных</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=33655&amp;view=findpost&amp;p=220521</guid>
        <pubDate>Wed, 09 Oct 2002 02:43:47 +0000</pubDate>
        <title>Драйвер ODBC не поддерживает динамических...</title>
        <link>https://forum.sources.ru/index.php?showtopic=33655&amp;view=findpost&amp;p=220521</link>
        <description><![CDATA[Gurza: А ты ставил MDAC 2.5, 2.6?<br><br>Провер синтаксис строки.]]></description>
        <author>Gurza</author>
        <category>C/C++: Базы данных</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=33655&amp;view=findpost&amp;p=220520</guid>
        <pubDate>Tue, 08 Oct 2002 19:30:55 +0000</pubDate>
        <title>Драйвер ODBC не поддерживает динамических...</title>
        <link>https://forum.sources.ru/index.php?showtopic=33655&amp;view=findpost&amp;p=220520</link>
        <description><![CDATA[Dim0S: Подскажите, плз, что делать в случае, когда выскакивает сообщение<br>&quot;Драйвер ODBC не поддерживает динамических подмножеств данных&quot;<br>Затык происходит, когда доходит до<br><br>CDatabase &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;KTSSettingDB;<br>CString &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strConnect(_T(&quot;DSN=KTSSettingsDB;UID=;PWD=;&quot;));<br>char &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;szPort[200];<br>// Коннектимся к базе<br>TRY<br> &nbsp; {<br> &nbsp; &nbsp; &nbsp; &nbsp;// Открываем базу данных, используя предварительно созданный<br> &nbsp; &nbsp; &nbsp; &nbsp;// псевдо DSN<br> &nbsp; &nbsp; &nbsp; &nbsp;KTSSettingDB.OpenEx(strConnect, CDatabase::noOdbcDialog);<br> &nbsp; &nbsp; &nbsp; &nbsp;// Распределяем записи<br> &nbsp; &nbsp; &nbsp; &nbsp;CODBCRecordset recset(&amp;KTSSettingDB);<br><br> &nbsp; &nbsp; &nbsp;// подготовим запрос<br> &nbsp; &nbsp; wsprintf( szPort, <br> &nbsp; &nbsp; &nbsp;&quot;SELECT id_realmoduls, prop_rmod FROM realmoduls WHERE id_objects = \%d AND &nbsp; &nbsp;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; id_moduls = 7 AND parent_rmod = 0&quot;, nObjectID);<br><br> &nbsp; &nbsp; &nbsp; &nbsp;recset.Open(szPort, CRecordset::dynaset); &lt;- вот здесь<br><br>Это недоделанные драйвера ODBC?<br>В таком случае где можно найти &quot;доделанные&quot;.<br>ЗЫ: база фокспрошная]]></description>
        <author>Dim0S</author>
        <category>C/C++: Базы данных</category>
      </item>
	
      </channel>
      </rss>
	