Category : ado

I have a simple piece of code written in C++ (Visual Studio Professional 2019) to open a (32-bit) access database : #import "c:Program FilesCommon FilesSystemADOmsado15.dll" no_namespace rename("EOF", "EndOfFile") try { // open connection m_pConnectionPtr.CreateInstance(__uuidof(Connection)); bstr_t strCnn("Driver={Microsoft Access Driver (*.mdb)};Dbq=d:MyDatabase.mdb;User ID=sa;"); m_pConnectionPtrReceptuur->Open(strCnn, "", "", NULL); } catch (_com_error& e) { // do something } This works ..

Read more

I try to connect in a C++ via Ado to a MariaDB Database. CADODatabase m_dbConnection; (my test.h) m_dbConnection.SetConnectionString(strConnectionString); m_dbConnection.SetConnectionTimeout(60); Connection String is DRIVER={MariaDB ODBC 3.1 Driver}; Server=10.15.180.21; Port=3306; database=db; UID=8001; password=********; I tried to setup a DSN but I don´t know how the connection string has to look like? DSN=Name; Is it important if the ..

Read more

Given a given MySQL table DESC tabl_foo; ——————————– Field Type Null Key Default Extra —————————————————————– fooId varchar(15) NO PRI NULL FooDate date YES MUL NULL I need to update FooDate for a given row. So I tried this code : query->SQL->Add("UPDATE tbl_foo SET FooDate = :FooDate WHERE fooId = :id"): // both arguments are AnsiString ..

Read more

In the following code scenario, after calling func1() a memory leak is observed. CoUninitialize() was expected to release that memory. But I guess that’s not happening. Is there anything more to add? void TestDBConnections(){ int iErrorCode = 0; _ConnectionPtr m_pConnection; HRESULT hr; try { TESTHR(hr = m_pConnection.CreateInstance(__uuidof(Connection))); if (SUCCEEDED(hr)) { _bstr_t sCS("DSN=xxxxx;UID=xxxxx;PWD=xxxxx;Provider=SQLNCLI11;Driver={SQL Server Native Client ..

Read more

Im having issues adding the MS ADO type libraries into a large established MFC C++ project. Im using MS VS2015 for this project and the import directive im using is as follows: #import "C:Program FilesCommon FilesSystemadomsado28.tlb" rename_namespace("ADO_CG") rename("EOF","EndOfFile") Originally I made a blank test project to create basic functionality and it was working great. I ..

Read more

When connecting to a database my program sometimes runs into an exception (_com_error – E_OUTOFMEMORY). This happens after I closed the database and reopens it, which I do once every 24h. As my program runs 24/24, doing moderate database access, this is not acceptable. I wrote a small console program to test the opening and ..

Read more