L
lifepass
Unregistered / Unconfirmed
GUEST, unregistred user!
在DLL中使用数据模块.和平常有什么不一样的.我刚学,写了个例子编译可以通过,可是运行出错.
//---------------------------------------------------------------------------
#include <windows.h>
#include "StoredProcess.h"
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
switch(reason)
{
case DLL_PROCESS_ATTACH:
CoInitialize(NULL);
break;
case DLL_PROCESS_DETACH:
CoUninitialize();
break;
case DLL_THREAD_DETACH:
CoUninitialize();
break;
case DLL_THREAD_ATTACH:
CoInitialize(NULL);
break;
}
return 1;
}
//---------------------------------------------------------------------------
extern "C"
__declspec(dllexport) void __stdcall IV_RealStored(char *DevProviderName,const DynamicArray<int>& DevInfo)
{
dm_Stored->StoredProc_CDS->ProviderName=AnsiString(DevProviderName);
dm_Stored->StoredProc_CDS->Params->Clear();
for(int i=0;i<=DevInfo.Length;i++)
{
dm_Stored->StoredProc_CDS->Params->Add();
if(i==0)
dm_Stored->StoredProc_CDS->Params->Items[0]->AsDateTime = DateTimeToStr(Now());
else
dm_Stored->StoredProc_CDS->Params->Items->AsInteger=DevInfo[i-1];
}
dm_Stored->StoredProc_CDS->Execute();
}
//---------------------------------------------------------------------------
#include <windows.h>
#include "StoredProcess.h"
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
switch(reason)
{
case DLL_PROCESS_ATTACH:
CoInitialize(NULL);
break;
case DLL_PROCESS_DETACH:
CoUninitialize();
break;
case DLL_THREAD_DETACH:
CoUninitialize();
break;
case DLL_THREAD_ATTACH:
CoInitialize(NULL);
break;
}
return 1;
}
//---------------------------------------------------------------------------
extern "C"
__declspec(dllexport) void __stdcall IV_RealStored(char *DevProviderName,const DynamicArray<int>& DevInfo)
{
dm_Stored->StoredProc_CDS->ProviderName=AnsiString(DevProviderName);
dm_Stored->StoredProc_CDS->Params->Clear();
for(int i=0;i<=DevInfo.Length;i++)
{
dm_Stored->StoredProc_CDS->Params->Add();
if(i==0)
dm_Stored->StoredProc_CDS->Params->Items[0]->AsDateTime = DateTimeToStr(Now());
else
dm_Stored->StoredProc_CDS->Params->Items->AsInteger=DevInfo[i-1];
}
dm_Stored->StoredProc_CDS->Execute();
}