powered by simpleCommunicator - 2.0.60     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Программирование [игнор отключен] [закрыт для гостей] / atl ole db consumer
1 сообщений из 1, страница 1 из 1
atl ole db consumer
    #32783370
Джек
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Добрый день всем!
Подскажите пожалуйста (или дайте ссылку) как работать с классом atl ole db consumer,т.е. читать и модифицировать наборы данных?
Я вставил такой класс:

[
// #error Security Issue: The connection string may contain a password
// The connection string below may contain plain text passwords and/or
// other sensitive information. Please remove the #error after reviewing
// the connection string for any security related issues. You may want to
// store the password in some other form or use a different user authentication.
db_source(L"Provider=MSDASQL.1;Persist Security Info=False;Data Source=lena;Extended Properties=\"DSN=mydsn\""),
db_table(L"DBA.testgr")
]
class CDBAtestgr1
{
public:
[ db_column(1, status=m_dwxStatus, length=m_dwxLength) ] double m_x;
[ db_column(2, status=m_dwyStatus, length=m_dwyLength) ] double m_y;

// The following wizard-generated data members contain status
// values for the corresponding fields. You
// can use these values to hold NULL values that the database
// returns or to hold error information when the compiler returns
// errors. See Field Status Data Members in Wizard-Generated
// Accessors in the Visual C++ documentation for more information
// on using these fields.
// NOTE: You must initialize these fields before setting/inserting data!

DBSTATUS m_dwxStatus;
DBSTATUS m_dwyStatus;

// The following wizard-generated data members contain length
// values for the corresponding fields.
// NOTE: For variable-length columns, you must initialize these
// fields before setting/inserting data!

DBLENGTH m_dwxLength;
DBLENGTH m_dwyLength;


void GetRowsetProperties(CDBPropSet* pPropSet)
{
pPropSet->AddProperty(DBPROP_CANFETCHBACKWARDS, true, DBPROPOPTIONS_OPTIONAL);
pPropSet->AddProperty(DBPROP_CANSCROLLBACKWARDS, true, DBPROPOPTIONS_OPTIONAL);
pPropSet->AddProperty(DBPROP_IRowsetChange, true, DBPROPOPTIONS_OPTIONAL);
pPropSet->AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE);
}
};



Затем пытаюсь сделать так
...
...
...
HRESULT hr;
CoInitialize(NULL);

CDBAtestgr1 aaa;
if(SUCCEEDED(aaa.OpenDataSource()))
{
CDBPropSet propset(DBPROPSET_ROWSET);
CDBAtestgr1 bbb;
bbb.GetRowsetProperties(&propset);
bbb.m_x=5;
bbb.m_y=6;
hr=bbb.Insert();
hr=bbb.Update ();


}

CoUninitialize();
...
...
...
На строке hr=bbb.Insert() выдаётся ошибка E_NOINTERFACE.
Заранее большое спасибо!!!
...
Рейтинг: 0 / 0
1 сообщений из 1, страница 1 из 1
Форумы / Программирование [игнор отключен] [закрыт для гостей] / atl ole db consumer
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]