I am extremely thankful to u that u r taking so much pains to solve my problem but at the same time i am really sorry that i am giving u a long piece of code. I tried to cut it short as much as possible but couldn't do much as i thought u must go thru atleast this much of code to understand it.
Thanx alot agian
Hoping for a quick response..
Here it is
My vb code is creating an instance of GenMastMaint(MasterMaintenence MTS object).
PrintTable is the method of GenMastMaint and it is creating an instance of another MTS component ADOClass(database component)
My client machine has all the MTS components registered on it thru the exe which gets created on MTS server when u export the package
VB Code:
Dim obj as GenMastMaintInt 'interface of the component'
set obj = new GenMastMaintInt 'GIVES ME A SWTICH TO DIALOG BOX HERE BUT GOES OFF AFTER CLICKING 2-3 times
result = obj.PrintTable("tablename",arrayofcolumnstobedisplayed,resultarray) 'GIVES ME A "PERMANENT SWITCH TO" Dialog Box
'display of values using loop
GenMastMaint.PrintTable Code (VC++)
//Decalrations
Creating an object of ADOClass
IADOClassInt *p = NULL;
hr = m_spObjectContext->CreateInstance(CLSID_ADOClassInt,IID_IADOClassInt,(void**)&p);
\\code to get the values of passed columns and store in a char. array
try
{
OutputDebugString("GenMastMaintInt

rintTable:Entering Method PrintTable"

;
if(vColumns->vt & VT_BYREF)
{
psaCol = *(vColumns->pparray);
}
else
{
psaCol = vColumns->parray;
}
//check the dimension of array if invalid then return the error
if(SafeArrayGetDim(psaCol) !=1)
{
TESTHR(E_INVALIDARG);
}
//get the lower and upper bounds
SafeArrayGetLBound(psaCol,1,&lLbound);
SafeArrayGetUBound(psaCol,1,&lUbound);
//compute the number of elements
cElements = lUbound - lLbound + 1;
OutputDebugString("outside for loop"

;
//access the elements of the array and store in char array
for(cCnt = lLbound;cCnt <= lUbound; cCnt++)
{
OutputDebugString("inside for loop"

;
VARIANT vVal;
SafeArrayGetElement(psaCol,&cCnt,&vVal);
OutputDebugString("after get element"

;
bval=vVal.bstrVal;
//Code for initializing the key value
OutputDebugString("before widechar"

;
******in this method the control stops here***refer to note at the end
iretval = WideCharToMultiByte(CP_ACP,0,bval,-1,sColumns[cCnt],sizeof(sColumns[cCnt]),NULL,NULL);
OutputDebugString("value of columns array-- "

;
OutputDebugString(sColumns[cCnt]);
::SysFreeString(bval);
}//loop end
lretval = fnGetdbinfo(szdsnname,szdbname,szusername,spwd);
//opening the connection
TESTHR(p->Open(sdsnname, susername,spwd));
nOpen = 1;
iretval = WideCharToMultiByte(CP_ACP,0,bTablename,-1,cTablename,sizeof(cTablename),NULL,NULL);
OutputDebugString("value of variable cTablename"

;
OutputDebugString(cTablename);
wsprintf(sQuery,"select rows from sysindexes where id = OBJECT_ID('%s') and indid <2",cTablename);
OutputDebugString("value of query to get rows"

;
OutputDebugString(sQuery);
******************in another method code stops here********
p->OpenRecordset(sQuery);
***Note***
i created another method having exactly the same code but eliminated the 2nd parameter( columns to display). this method simply takes the table name and return all the rows.
But in this method the control stops just before OpenRecordset of ADOClass( mentioned above)
ADOClass Code:
ADOClass.Open
STDMETHODIMP CADOClassInt::Open(BSTR source, BSTR user, BSTR pwd)
{
// TODO: Add your implementation code here
/*****************************/
HRESULT hr;
void *pMsgBuf;
// char cBuf[100];
char csource[20],cuser[20],cpwd[20];
int iretval;
memset(csource,'\0',20);
memset(cuser,'\0',20);
memset(cpwd,'\0',20);
//IITPEvtLogObj *p1 = NULL;
try
{
hr = S_OK;
OutputDebugString("ADOTierCls::Open:entered the open function"

;
//conversions
iretval = WideCharToMultiByte(CP_ACP,0,source,-1,csource,sizeof(csource),NULL,NULL);
iretval = WideCharToMultiByte(CP_ACP,0,user,-1,cuser,sizeof(cuser),NULL,NULL);
iretval = WideCharToMultiByte(CP_ACP,0,pwd,-1,cpwd,sizeof(cpwd),NULL,NULL);
OutputDebugString("ADOTierCls::Open:after the conversions to multibyte"

;
OutputDebugString("ADOTierCls::Open:before creating the connection object"

;
//HRESULT hr = m_connection.CreateInstance("ADODB.Connection.2.1"

;
hr = m_connection.CreateInstance(__uuidof(Connection));
// m_spObjectContext->CreateInstance(__uuidof(Connection), __uuidof(_Connection),
// (void**)&m_connection);
OutputDebugString("ADOTierCls::Open:after connection of main connection"

;
if (SUCCEEDED(hr))
{
//correct
//_bstr_t ssource("driver={SQL Server};server=ndl_frc_ntd03;uid=itpuser;pwd=itpuser;database=itpdb"

;
char query[255];
BSTR ssource;
OutputDebugString("ADOClass :Open: initializing the query "

;
//working 1
wsprintf(query,"DSN=%s;UID=%s;PWD=%s;",csource,cuser,cpwd);
ssource=(BSTR) (_bstr_t) query;
OutputDebugString("ADOClass :Open: Before opening the Data connection with DSN--"

;
m_connection->Open(ssource,NULL,NULL,adCmdUnspecified);
//m_connection->Open(ssource,NULL,NULL);
OutputDebugString("ADOClass :Open: After opening the Data connection with DSN"

;
OutputDebugString("ADOTierCls::Open

BConnection successfully opend"

;
//deallocating
::SysFreeString(ssource);
mExcStatus = 0;
}
if (SUCCEEDED(hr))
{
hr = m_command.CreateInstance(__uuidof(Command));
// hr = m_command.CreateInstance("ADODB.Command.2.1"

;
// m_spObjectContext->CreateInstance(__uuidof(Command), __uuidof(_Command),
// (void**)&m_command);
OutputDebugString("ADOTierCls::Open:Command object successfully created"

;
}
else
{
::FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,NULL,
hr,MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),(LPTSTR)&pMsgBuf,0,NULL);
OutputDebugString((LPTSTR)pMsgBuf);
LocalFree(pMsgBuf);
}
if (SUCCEEDED(hr))
{
hr = m_command->putref_ActiveConnection(m_connection);
OutputDebugString("ADOTierCls::Open:Active connection successfully opend"

;
}
if (SUCCEEDED(hr))
{
hr = m_recordset.CreateInstance(__uuidof(Recordset));
//m_spObjectContext->CreateInstance(__uuidof(Recordset), __uuidof(_Recordset),
// (void**)&m_recordset);
OutputDebugString("ADOTierCls::Open:REcordset successfully created"

;
}
else
{
::FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,NULL,
hr,MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),(LPTSTR)&pMsgBuf,0,NULL);
OutputDebugString((LPCTSTR)pMsgBuf);
LocalFree(pMsgBuf);
}
}//try
ADOClass.OpenRecordset:
STDMETHODIMP CADOClassInt::OpenRecordset(VARIANT query)
{
VARIANT v;
V_VT(&v) = VT_DISPATCH;
V_DISPATCH(&v) = (IDispatch*) m_connection;
// Need the AddRef() as VariantClear() calls Release(), unless fAddRef
// false indicates we're taking ownership
//
V_DISPATCH(&v)->AddRef();
//return m_recordset->Open(query, v, adOpenDynamic, adLockOptimistic, adCmdText);
return m_recordset->Open(query, v, adOpenStatic, adLockReadOnly, adCmdText);
}