<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Help on ADO with ObjectARX in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/help-on-ado-with-objectarx/m-p/1606607#M23934</link>
    <description>Thanx to google after many ours of searching with various combinations of keywords I found that it was due to naming conflict and  modifying my #import directive to :&lt;BR /&gt;
&lt;BR /&gt;
#import "c:\\program files\\common files\\system\\ado\\msado15.dll"   &lt;BR /&gt;
 \&lt;BR /&gt;
rename ("EOF", "adoEOF") \&lt;BR /&gt;
  rename("EOS","AdoEOS") &lt;BR /&gt;
&lt;BR /&gt;
solved my problem.&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
&lt;BR /&gt;
Alam</description>
    <pubDate>Sun, 09 Apr 2006 12:46:01 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-04-09T12:46:01Z</dc:date>
    <item>
      <title>Help on ADO with ObjectARX</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/help-on-ado-with-objectarx/m-p/1606606#M23933</link>
      <description>I am just trying to get connection to external database using ado&lt;BR /&gt;
#import directive. Infact  I just merged the code from two samples and they works fine separately but when I pull them together its showing following errors:&lt;BR /&gt;
&lt;BR /&gt;
c:\temp\aaa\debug\msado15.tlh(2667) : error C2059: syntax error : 'constant'&lt;BR /&gt;
c:\temp\aaa\debug\msado15.tlh(2667) : error C2238: unexpected token(s) preceding ';'&lt;BR /&gt;
&lt;BR /&gt;
code:&lt;BR /&gt;
// aaa.cpp : Initialization functions&lt;BR /&gt;
#include "StdAfx.h"&lt;BR /&gt;
#include "StdArx.h"&lt;BR /&gt;
#include "resource.h"&lt;BR /&gt;
#include &lt;STDLIB.H&gt;&lt;BR /&gt;
#import "C:\Program Files\Common Files\System\ado\MSADO15.dll" rename("EOF", "ADOEOFile")&lt;BR /&gt;
void mydbcon();&lt;BR /&gt;
&lt;BR /&gt;
struct StartOLEProcess{&lt;BR /&gt;
    StartOLEProcess(  ) {&lt;BR /&gt;
        ::CoInitialize(NULL);&lt;BR /&gt;
    }&lt;BR /&gt;
    ~StartOLEProcess(  ) {&lt;BR /&gt;
        ::CoUninitialize(  );&lt;BR /&gt;
    }&lt;BR /&gt;
} _start_StartOLEProcess;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
// This command registers an ARX command.&lt;BR /&gt;
void AddCommand(const char* cmdGroup, const char* cmdInt, const char* cmdLoc,&lt;BR /&gt;
				const int cmdFlags, const AcRxFunctionPtr cmdProc, const int idLocal = -1);&lt;BR /&gt;
&lt;BR /&gt;
// NOTE: DO NOT edit the following lines.&lt;BR /&gt;
//{{AFX_ARX_MSG&lt;BR /&gt;
void InitApplication();&lt;BR /&gt;
void UnloadApplication();&lt;BR /&gt;
//}}AFX_ARX_MSG&lt;BR /&gt;
&lt;BR /&gt;
// NOTE: DO NOT edit the following lines.&lt;BR /&gt;
//{{AFX_ARX_ADDIN_FUNCS&lt;BR /&gt;
//}}AFX_ARX_ADDIN_FUNCS&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
/////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
// ObjectARX EntryPoint&lt;BR /&gt;
extern "C" AcRx::AppRetCode &lt;BR /&gt;
acrxEntryPoint(AcRx::AppMsgCode msg, void* pkt)&lt;BR /&gt;
{&lt;BR /&gt;
	switch (msg) {&lt;BR /&gt;
	case AcRx::kInitAppMsg:&lt;BR /&gt;
		// Comment out the following line if your&lt;BR /&gt;
		// application should be locked into memory&lt;BR /&gt;
		acrxDynamicLinker-&amp;gt;unlockApplication(pkt);&lt;BR /&gt;
		acrxDynamicLinker-&amp;gt;registerAppMDIAware(pkt);&lt;BR /&gt;
		InitApplication();&lt;BR /&gt;
		break;&lt;BR /&gt;
	case AcRx::kUnloadAppMsg:&lt;BR /&gt;
		UnloadApplication();&lt;BR /&gt;
		break;&lt;BR /&gt;
	}&lt;BR /&gt;
	return AcRx::kRetOK;&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
// Init this application. Register your&lt;BR /&gt;
// commands, reactors...&lt;BR /&gt;
void InitApplication()&lt;BR /&gt;
{&lt;BR /&gt;
	// NOTE: DO NOT edit the following lines.&lt;BR /&gt;
	//{{AFX_ARX_INIT&lt;BR /&gt;
	//}}AFX_ARX_INIT&lt;BR /&gt;
&lt;BR /&gt;
	acedRegCmds-&amp;gt;addCommand("MYDBCON_COMMANDS",&lt;BR /&gt;
                            "dblog",&lt;BR /&gt;
                            "dblog",&lt;BR /&gt;
                            ACRX_CMD_MODAL,&lt;BR /&gt;
                            mydbcon);&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
	// TODO: add your initialization functions&lt;BR /&gt;
&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
// Unload this application. Unregister all objects&lt;BR /&gt;
// registered in InitApplication.&lt;BR /&gt;
void UnloadApplication()&lt;BR /&gt;
{&lt;BR /&gt;
	// NOTE: DO NOT edit the following lines.&lt;BR /&gt;
	//{{AFX_ARX_EXIT&lt;BR /&gt;
	//}}AFX_ARX_EXIT&lt;BR /&gt;
&lt;BR /&gt;
	// TODO: clean up your application&lt;BR /&gt;
	acedRegCmds-&amp;gt;removeGroup("HELLOWORLD_COMMANDS");&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
// This functions registers an ARX command.&lt;BR /&gt;
// It can be used to read the localized command name&lt;BR /&gt;
// from a string table stored in the resources.&lt;BR /&gt;
void AddCommand(const char* cmdGroup, const char* cmdInt, const char* cmdLoc,&lt;BR /&gt;
				const int cmdFlags, const AcRxFunctionPtr cmdProc, const int idLocal)&lt;BR /&gt;
{&lt;BR /&gt;
	char cmdLocRes[65];&lt;BR /&gt;
&lt;BR /&gt;
	// If idLocal is not -1, it's treated as an ID for&lt;BR /&gt;
	// a string stored in the resources.&lt;BR /&gt;
	if (idLocal != -1) {&lt;BR /&gt;
		HMODULE hModule = GetModuleHandle("Adskaaa.arx");&lt;BR /&gt;
&lt;BR /&gt;
		// Load strings from the string table and register the command.&lt;BR /&gt;
		::LoadString(hModule, idLocal, cmdLocRes, 64);&lt;BR /&gt;
		acedRegCmds-&amp;gt;addCommand(cmdGroup, cmdInt, cmdLocRes, cmdFlags, cmdProc);&lt;BR /&gt;
&lt;BR /&gt;
	} else&lt;BR /&gt;
		// idLocal is -1, so the 'hard coded'&lt;BR /&gt;
		// localized function name is used.&lt;BR /&gt;
		acedRegCmds-&amp;gt;addCommand(cmdGroup, cmdInt, cmdLoc, cmdFlags, cmdProc);&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
void mydbcon()&lt;BR /&gt;
{&lt;BR /&gt;
&lt;BR /&gt;
    acutPrintf("\nCreating db connection!");&lt;BR /&gt;
&lt;BR /&gt;
 // define our variables which will be used as references to the&lt;BR /&gt;
    // Connection and Recordset objects&lt;BR /&gt;
 &lt;BR /&gt;
    ADODB::_ConnectionPtr  con = NULL;&lt;BR /&gt;
    ADODB::_RecordsetPtr   rec = NULL;&lt;BR /&gt;
 &lt;BR /&gt;
    // define variables to read the Author field from the recordset&lt;BR /&gt;
    &lt;BR /&gt;
    ADODB::FieldPtr        pAuthor;&lt;BR /&gt;
    _variant_t              vAuthor;&lt;BR /&gt;
    char                   sAuthor[40];&lt;BR /&gt;
    &lt;BR /&gt;
    // create two strings for use with the creation of a Connection&lt;BR /&gt;
    // and a Recordset object&lt;BR /&gt;
    &lt;BR /&gt;
    bstr_t                 sConString;&lt;BR /&gt;
    bstr_t                 sSQLString;&lt;BR /&gt;
    &lt;BR /&gt;
    // create a variable to hold the result to function calls&lt;BR /&gt;
    &lt;BR /&gt;
    HRESULT                hr                = S_OK;&lt;BR /&gt;
    &lt;BR /&gt;
    // long variable needed for Execute method of Connection object&lt;BR /&gt;
    &lt;BR /&gt;
    VARIANT                *vRecordsAffected = NULL;&lt;BR /&gt;
 &lt;BR /&gt;
    // create a new instance of an ADO Connection object&lt;BR /&gt;
    &lt;BR /&gt;
    hr = con.CreateInstance(__uuidof(ADODB::Connection));&lt;BR /&gt;
    &lt;BR /&gt;
    acutPrintf("Connection object created.\n");&lt;BR /&gt;
    &lt;BR /&gt;
    // open the BiblioDSN data source with the Connection object&lt;BR /&gt;
    &lt;BR /&gt;
    sConString = L"Provider=Microsoft.Jet.OLEDB.4.0; " &lt;BR /&gt;
                 L"Data Source=C:\\Temp\\mydb.mdb";&lt;BR /&gt;
    &lt;BR /&gt;
    con-&amp;gt;Open(sConString, L"", L"", -1);&lt;BR /&gt;
    &lt;BR /&gt;
    acutPrintf("Connection opened.\n");&lt;BR /&gt;
    &lt;BR /&gt;
    // create a Recordset object from a SQL string&lt;BR /&gt;
    &lt;BR /&gt;
    sSQLString = L"SELECT password FROM tbl_master where user_id=='mal';";&lt;BR /&gt;
    &lt;BR /&gt;
    rec = con-&amp;gt;Execute(sSQLString,&lt;BR /&gt;
                       vRecordsAffected,&lt;BR /&gt;
                       1);&lt;BR /&gt;
    &lt;BR /&gt;
    acutPrintf("SQL statement processed.\n");&lt;BR /&gt;
    &lt;BR /&gt;
    // point to the Author field in the recordset&lt;BR /&gt;
    &lt;BR /&gt;
    pAuthor = rec-&amp;gt;Fields-&amp;gt;GetItem("Author");&lt;BR /&gt;
    &lt;BR /&gt;
    // retrieve all the data within the Recordset object&lt;BR /&gt;
    &lt;BR /&gt;
    acutPrintf("Getting data now...\n\n");&lt;BR /&gt;
    &lt;BR /&gt;
    while(!rec-&amp;gt;ADOEOFile) {&lt;BR /&gt;
    &lt;BR /&gt;
        // get the Author field's value and change it &lt;BR /&gt;
        // to a multibyte type&lt;BR /&gt;
        vAuthor.Clear(  );&lt;BR /&gt;
        &lt;BR /&gt;
        vAuthor = pAuthor-&amp;gt;Value;&lt;BR /&gt;
        &lt;BR /&gt;
        WideCharToMultiByte(CP_ACP,&lt;BR /&gt;
                            0,&lt;BR /&gt;
                            vAuthor.bstrVal,&lt;BR /&gt;
                            -1,&lt;BR /&gt;
                            sAuthor,&lt;BR /&gt;
                            sizeof(sAuthor),&lt;BR /&gt;
                            NULL,&lt;BR /&gt;
                            NULL);&lt;BR /&gt;
        &lt;BR /&gt;
        acutPrintf("%s\n", sAuthor);&lt;BR /&gt;
        &lt;BR /&gt;
        rec-&amp;gt;MoveNext(  );&lt;BR /&gt;
    &lt;BR /&gt;
    }&lt;BR /&gt;
    &lt;BR /&gt;
    acutPrintf("\nEnd of data.\n");&lt;BR /&gt;
 &lt;BR /&gt;
    // close and remove the Recordset object from memory&lt;BR /&gt;
    &lt;BR /&gt;
    rec-&amp;gt;Close(  );&lt;BR /&gt;
    rec = NULL;&lt;BR /&gt;
    &lt;BR /&gt;
    acutPrintf("Closed an removed the "&lt;BR /&gt;
           "Recordset object from memory.\n");&lt;BR /&gt;
    &lt;BR /&gt;
    // close and remove the Connection object from memory&lt;BR /&gt;
    &lt;BR /&gt;
    con-&amp;gt;Close(  );&lt;BR /&gt;
    con = NULL;&lt;BR /&gt;
    &lt;BR /&gt;
    acutPrintf("Closed and removed the "&lt;BR /&gt;
           "Connection object from memory.\n");&lt;BR /&gt;
&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Please help me.&lt;BR /&gt;
ObjectARX 2000&lt;BR /&gt;
VS 6.0&lt;BR /&gt;
Windows 2000 SP4&lt;BR /&gt;
ADO 2.8&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
&lt;BR /&gt;
Alam&lt;/STDLIB.H&gt;</description>
      <pubDate>Sat, 08 Apr 2006 12:50:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/help-on-ado-with-objectarx/m-p/1606606#M23933</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-08T12:50:49Z</dc:date>
    </item>
    <item>
      <title>Re: Help on ADO with ObjectARX</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/help-on-ado-with-objectarx/m-p/1606607#M23934</link>
      <description>Thanx to google after many ours of searching with various combinations of keywords I found that it was due to naming conflict and  modifying my #import directive to :&lt;BR /&gt;
&lt;BR /&gt;
#import "c:\\program files\\common files\\system\\ado\\msado15.dll"   &lt;BR /&gt;
 \&lt;BR /&gt;
rename ("EOF", "adoEOF") \&lt;BR /&gt;
  rename("EOS","AdoEOS") &lt;BR /&gt;
&lt;BR /&gt;
solved my problem.&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
&lt;BR /&gt;
Alam</description>
      <pubDate>Sun, 09 Apr 2006 12:46:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/help-on-ado-with-objectarx/m-p/1606607#M23934</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-09T12:46:01Z</dc:date>
    </item>
  </channel>
</rss>

