Category : ado

For a Microsoft SQL server would execute the query: SELECT COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH FROM INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = TableName; Which would work…but if my source is an excel spreadsheet that does not work. The problem being no knowledge of what INFORMATION_SCHEMA or INFORMATION_SCHEMA.COLUMNS is. So my question is how to get Column Name, Data type, ..

Read more

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