Форум программистов «Весельчак У»
  *
Добро пожаловать, Гость. Пожалуйста, войдите или зарегистрируйтесь.
Вам не пришло письмо с кодом активации?

  • Рекомендуем проверить настройки временной зоны в вашем профиле (страница "Внешний вид форума", пункт "Часовой пояс:").
  • У нас больше нет рассылок. Если вам приходят письма от наших бывших рассылок mail.ru и subscribe.ru, то знайте, что это не мы рассылаем.
   Начало  
Наши сайты
Помощь Поиск Календарь Почта Войти Регистрация  
 
Страниц: [1]   Вниз
  Печать  
Автор Тема: Native C++, SQL2000, WM2003  (Прочитано 9118 раз)
0 Пользователей и 1 Гость смотрят эту тему.
bsisoft
Гость
« : 21-08-2008 14:19 » 

Добрый день всем!
У меня просьба, киньте ссылки на пример подключения к серверу MSSQL 2000 из WM2003.
Очень нужен пример без .Net на WinAPI.
Попробовал следующий код, пишет что такие класс отсутсвует
Код:
#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF", "EndOfFile")
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
   CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
   try {
      [b]_ConnectionPtr pConn("ADODB.Connection");[/b] // Здесь вываливается Excepttion
      _RecordsetPtr pRst("ADODB.Recordset");

      pConn->Provider = "sqloledb";
      pConn->Open("Data Source='MyDesktop';Initial Catalog='pubs';Integrated Security=SSPI", "", "", adConnectUnspecified);

      // Note 1.
      pRst->Open("authors", _variant_t((IDispatch *) pConn, true), adOpenStatic, adLockReadOnly, adCmdTable);
      pRst->MoveLast();

      // Note 2.
     // printf("Last name is '%s %s'\n",
        // (char*) ((_bstr_t) pRst->GetFields()->GetItem("au_fname")->GetValue()),
        // (char*) ((_bstr_t) pRst->Fields->Item["au_lname"]->Value));

      pRst->Close();
      pConn->Close();
   }
   catch (_com_error &e) {
      printf("Description = '%s'\n", (char*) e.Description());
   }   
   ::CoUninitialize();
return 0L;
}


Заранее всем спасибо.
Записан
Алексей++
глобальный и пушистый
Глобальный модератор

ru
Offline Offline
Сообщений: 13


« Ответ #1 : 22-08-2008 04:39 » 

1)
Цитата
пишет что такие класс отсутсвует
какие именно, о чём пишет то ? )

2) текст из ексепшена - в студию, полюбому Улыбаюсь
Записан

bsisoft
Гость
« Ответ #2 : 22-08-2008 06:28 » 

1)
Цитата
пишет что такие класс отсутсвует
какие именно, о чём пишет то ? )
Код:
e.m_hresult
-2147221005
{Недопустимая строка с указанием класса }
Записан
Алексей++
глобальный и пушистый
Глобальный модератор

ru
Offline Offline
Сообщений: 13


« Ответ #3 : 22-08-2008 06:34 » 

нашёл в мсдне такую плюшку, не знаю - поможет или нет, ибо я не в теме Улыбаюсь
Цитата
-2147221005 (800401F3)    Invalid class string.
<...>
SYMPTOMS
The following error message may display when SQL Server connects to a Cluster Server through the Cluster Administrator. For instance, if the Microsoft Search Service is not available, the following error message may occur:
An error occurred attempting to read properties for the "Microsoft Search Service Instance" resource type.
Invalid Class String
Error Id -2147221005(800401f3)
-or-

An error occurred attempting to read properties for the 'Microsoft Search Service Instance' resource type: The specified node does not support a resource of this type. This may be due to version inconsistencies or due to the absence of the resource DLL on this node.
The resource type that appears in the error message may be different depending on your specific environment.
CAUSE
The error message occurs because of one of the following reasons (the DLL or resource may vary depending on your environment):
The Microsoft Search Service resource DLL file, Gathercl.dll, is not present in the %systemroot%\Winnt\Cluster folder.
The account that is logged in does not have sufficient permissions to access the folder.

WORKAROUND
To work around this problem:
 -For the example error message listed in the first bullet item of the Cause section, make sure that Gathercl.dll is present in the %systemroot%\Winnt\Cluster folder. If Gathercl.dll is not present, copy Gathercl.dll from the SQL Server CD and place it in the %systemroot%\Winnt\Cluster folder. Register the DLL by using Regsvr32. If you have a Service Pack installed, copy the Gathercl.dll file from the Service Pack files.
 -Make sure that the account that you use to login to the Cluster has full control over the %systemroot%\winnt\Cluster folder and all the files in the folder.
Записан

bsisoft
Гость
« Ответ #4 : 22-08-2008 09:39 » 

Я так понял это относится к Win32. Под виндой этот код работает, а под WM2003 не хочет А черт его знает...
Записан
Страниц: [1]   Вверх
  Печать  
 

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines