Click here to Skip to main content
15,919,749 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to display a bitmap when starting an application? Pin
jean-michel vanye18-Nov-03 3:17
jean-michel vanye18-Nov-03 3:17 
Questionhow to add *.hpp defined by myself to the*.cpp? Pin
Anonymous17-Nov-03 22:30
Anonymous17-Nov-03 22:30 
AnswerRe: how to add *.hpp defined by myself to the*.cpp? Pin
Anonymous17-Nov-03 23:12
Anonymous17-Nov-03 23:12 
GeneralMapAndLoad() Pin
hph17-Nov-03 22:27
hph17-Nov-03 22:27 
GeneralKill a process!! Pin
chadell17-Nov-03 22:18
chadell17-Nov-03 22:18 
GeneralRe: Kill a process!! Pin
Brian Shifrin17-Nov-03 22:48
Brian Shifrin17-Nov-03 22:48 
GeneralRe: Kill a process!! Pin
Michael Gunlock18-Nov-03 9:59
Michael Gunlock18-Nov-03 9:59 
Generalado nextrecordset failed Pin
zhangxinghai17-Nov-03 21:47
zhangxinghai17-Nov-03 21:47 
I create a com object using vc++.I want to return two recordsets in one call.The object has a method(Mymethod) like this
#define VS_CONNECT_1 L"Provider=SQLOLEDB;password=Pass;persist Security Info=True;User ID=User;Initial Catalog=pubs;Data Source=sqlserver;"
Mymethod(IDispatch **pRs1,IDispatch **pRs2)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())

// TODO: Add your implementation code here

_RecordsetPtr pRSMems,pRS1
HRESULT hr;
try {

_bstr_t strSQL;
strSQL = "select * from authors;select * from employee";
hr = pRSMems.CreateInstance (__uuidof(Recordset));
if (FAILED(hr)) _com_raise_error (hr);
pRSMems->CursorLocation = adUseClient;

hr = pRSMems->Open(strSQL, VS_CONNECT_1, adOpenStatic,
adLockBatchOptimistic, adCmdText);
if (FAILED(hr)) _com_raise_error (hr);
pRS1 = pRSMems->Clone(adLockUnspecified);

pRSMems->putref_ActiveConnection(NULL);
*pRs1 = pRSMems.Detach();
long cnt = 0;
pRS1 = pRS1->NextRecordset((VARIANT *)cnt);
pRS1->putref_ActiveConnection(NULL);
*pRs2 = pRS1.Detach();
return S_OK;


} catch (_com_error &e) {
HRESULT hrerr = e.Error();
return hrerr;
}
}
I call it in VB
Dim obj As Object
Dim rst As Recordset
Dim i
Dim rst1 As Recordset
Set obj = CreateObject("mycom.object")
i = obj.mymethod(rst, rst1)
Do While Not rst.EOF
MsgBox rst.Fields(1)
rst.MoveNext
Loop
Do While Not rst1.EOF
MsgBox rst1.Fields(2)
rst1.MoveNext
Loop
I clone a new recordset,then put activeconnection of original recordset to null.But I fails yet.I need help.
thanks.
Confused | :confused:


GeneralHelp drawing vertical text Pin
Juan Carlos Cobas17-Nov-03 21:33
Juan Carlos Cobas17-Nov-03 21:33 
GeneralMSMQ Pin
arthivjii17-Nov-03 20:12
arthivjii17-Nov-03 20:12 
GeneralRe: MSMQ Pin
Dudi Avramov18-Nov-03 2:57
Dudi Avramov18-Nov-03 2:57 
Generalstrange warning Pin
Jerome Conus17-Nov-03 19:35
Jerome Conus17-Nov-03 19:35 
GeneralRe: strange warning Pin
Michael Dunn17-Nov-03 19:59
sitebuilderMichael Dunn17-Nov-03 19:59 
GeneralRe: strange warning Pin
Jerome Conus17-Nov-03 20:07
Jerome Conus17-Nov-03 20:07 
GeneralRe: strange warning Pin
Prakash Nadar17-Nov-03 23:52
Prakash Nadar17-Nov-03 23:52 
GeneralColumn based selection; Pin
Bo Hunter17-Nov-03 19:29
Bo Hunter17-Nov-03 19:29 
QuestionMaximum length of string?? Pin
xxhimanshu17-Nov-03 19:28
xxhimanshu17-Nov-03 19:28 
AnswerRe: Maximum length of string?? Pin
Michael Dunn17-Nov-03 20:01
sitebuilderMichael Dunn17-Nov-03 20:01 
GeneralRe: Maximum length of string?? Pin
xxhimanshu17-Nov-03 20:05
xxhimanshu17-Nov-03 20:05 
GeneralDeveloping for Pocket PC Pin
georgiek5017-Nov-03 18:58
georgiek5017-Nov-03 18:58 
GeneralRe: Developing for Pocket PC Pin
Michael P Butler17-Nov-03 22:42
Michael P Butler17-Nov-03 22:42 
GeneralRe: Developing for Pocket PC Pin
georgiek5017-Nov-03 22:48
georgiek5017-Nov-03 22:48 
QuestionCMap Efficiency??? Pin
Uma Mahes17-Nov-03 18:04
Uma Mahes17-Nov-03 18:04 
AnswerRe: CMap Efficiency??? Pin
Brian Shifrin18-Nov-03 0:03
Brian Shifrin18-Nov-03 0:03 
Questionprinter help? Pin
murali_utr17-Nov-03 18:01
murali_utr17-Nov-03 18:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.