示例#1
0
SQLBRIDGE_API void end_tran(long long m_handle)
{
	IntPtr^ pointer = gcnew IntPtr(m_handle);
	GCHandle handle = GCHandle::FromIntPtr(*pointer);
	SqlTransaction^ tran = safe_cast<SqlTransaction^>(handle.Target);
	tran->Commit();
	//释放句柄
	handle.Free();
}
示例#2
0
// ---------------------------------------------------------------
_DLLAPI void __stdcall DestroyManagedObject(long long hObject, 
											wchar_t* exType, 
											wchar_t* exMessage)
{
	if (hObject <= 0 
		|| exType == NULL 
		|| exMessage == NULL) return;

	try
	{
		GCHandle handle = GCHandle::FromIntPtr(IntPtr((HANDLE)hObject));
		handle.Free();
	}
	catch (Exception^ ex)
	{
		IntPtr exT = Marshal::StringToHGlobalUni(ex->GetType()->Name);
		wcsncpy(exType, (const wchar_t*)exT.ToPointer(), 64);
		Marshal::FreeHGlobal(exT);

		IntPtr exM = Marshal::StringToHGlobalUni(ex->Message);
		wcsncpy(exMessage, (const wchar_t*)exM.ToPointer(), 256);
		Marshal::FreeHGlobal(exM);
	}
}