[NEWBIE] Howto? Use Windows DataSourceLocator

J

Joseph

Hi.

I'm using ruby 1.8.1 (2003-12-25) [i386-mswin32]. I want to use Window's
built-in DataSourceLocator Prompt, in order to interactively retrieve
the datasource for an ADO connection to some user selected database.

In (Visual) C++ the I found a code snippet that does that. How
would I implement equivalent code in Ruby?

The Visual C++ code looks like this:
=========== C++ Code ============
// IDataSourceLocatorPtr is defined In Oledb32.tlh
IDataSourceLocatorPtr dlPrompt = NULL;

// code fragment:
try
{
// Instantiate DataLinks object.
TESTHR(hr = dlPrompt.CreateInstance(__uuidof(DataLinks)) );

// Prompt for connection information.
m_pConnection = dlPrompt->PromptNew();
}
=========== End C++ Code ===========

How do would I implement equivalent code in Ruby? I've tried a few
imaginative variations based on Ernest Ellingson's advice for ADO, but
all I get is the following error message:

dlPrompt = WIN32OLE.new('Oledb32.DataSourceLocator')

HRESULT error code:0x800401f3
Invalid class string
from (irb):2:in `initialize'
from (irb):2:in `new'
from (irb):2

TIA,
Joseph
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top