How to pass variables of type RecordSet from VB ocx to VC++ program???
-
Hello everyone, I am inserting vb activex control in VC program.In VB ocx program i am passing variables of type recordset from database.when i am inserting this ocx into my VC program those recordset datatypes are converting as LPDISPATCH* type. and my variables of type CRecordset. it is giving error like this: C:\Program Files\Microsoft Visual Studio\My Projects\RecordSetPgm\RecordSetPgmDlg.cpp(255) : error C2664: 'Processattendacne' : cannot convert parameter 1 from 'class CRecordset' to 'struct IDispatch ** ' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called VB ocx Code is like this: void C_UserControl1::Processattendacne(LPDISPATCH* rs, LPDISPATCH* rs1, BOOL* blnprocess) { static BYTE parms[] = VTS_PDISPATCH VTS_PDISPATCH VTS_PBOOL; InvokeHelper(0x60030000, DISPATCH_METHOD, VT_EMPTY, NULL, parms, rs, rs1, blnprocess); } And VC++ Code is like this: database.Open(NULL,false,false,sDsn); // Open Clients.MDB CRecordset recset( &database ); SqlString="SELECT field1 FROM sample"; recset.Open(CRecordset::dynamic,SqlString,CRecordset::readOnly); CRecordset recset1(&database); Client= "SELECT field2 FROM sample"; recset1.Open(CRecordset::dynamic,Client,CRecordset::readOnly); m_UserControl.Processattendacne(recset,recset1,bstr); database.Close(); please tell me what type of parameters i have to take and how should i declare those please tell me...please Help me out..i am trying this but i am not getting...please give me some suggestions.. Thanks in Advance, Savitri
-
Hello everyone, I am inserting vb activex control in VC program.In VB ocx program i am passing variables of type recordset from database.when i am inserting this ocx into my VC program those recordset datatypes are converting as LPDISPATCH* type. and my variables of type CRecordset. it is giving error like this: C:\Program Files\Microsoft Visual Studio\My Projects\RecordSetPgm\RecordSetPgmDlg.cpp(255) : error C2664: 'Processattendacne' : cannot convert parameter 1 from 'class CRecordset' to 'struct IDispatch ** ' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called VB ocx Code is like this: void C_UserControl1::Processattendacne(LPDISPATCH* rs, LPDISPATCH* rs1, BOOL* blnprocess) { static BYTE parms[] = VTS_PDISPATCH VTS_PDISPATCH VTS_PBOOL; InvokeHelper(0x60030000, DISPATCH_METHOD, VT_EMPTY, NULL, parms, rs, rs1, blnprocess); } And VC++ Code is like this: database.Open(NULL,false,false,sDsn); // Open Clients.MDB CRecordset recset( &database ); SqlString="SELECT field1 FROM sample"; recset.Open(CRecordset::dynamic,SqlString,CRecordset::readOnly); CRecordset recset1(&database); Client= "SELECT field2 FROM sample"; recset1.Open(CRecordset::dynamic,Client,CRecordset::readOnly); m_UserControl.Processattendacne(recset,recset1,bstr); database.Close(); please tell me what type of parameters i have to take and how should i declare those please tell me...please Help me out..i am trying this but i am not getting...please give me some suggestions.. Thanks in Advance, Savitri
I maybe wrong but you may need to use ADO instead of CRecordet. The VB ActiveX control you are using is expecting an IDispatch compatible interface as parameters. Some ADO examples are listed below - MSDN - ADO Code Examples in Visual C++[^] Codeproject - Database - ADO[^]
Sohail
-
I maybe wrong but you may need to use ADO instead of CRecordet. The VB ActiveX control you are using is expecting an IDispatch compatible interface as parameters. Some ADO examples are listed below - MSDN - ADO Code Examples in Visual C++[^] Codeproject - Database - ADO[^]
Sohail
hii It is only with simple program but i am passing variable to activeX control to do the operations like adding ,deleting etc..It is not taking of type recodeset directly..so tell me what data type i have to use.. please see my code..I pasted my code in my first message please will u tell me how to do this .. HELP ME OUT.. Thanks in advance, savitri
-
hii It is only with simple program but i am passing variable to activeX control to do the operations like adding ,deleting etc..It is not taking of type recodeset directly..so tell me what data type i have to use.. please see my code..I pasted my code in my first message please will u tell me how to do this .. HELP ME OUT.. Thanks in advance, savitri
CRecordset is an MFC class which is not IDispatch compatible. VB ActiveX method that you are using, requires an IDispatch interface as parameter. If you use ActiveX Data Object (ADO) instead of CRecordset class then you will be able to pass the object to your VB ActiveX methods. I have included the link to samples in my previous post. These will help you get started. I hope this helps.
Sohail
-
CRecordset is an MFC class which is not IDispatch compatible. VB ActiveX method that you are using, requires an IDispatch interface as parameter. If you use ActiveX Data Object (ADO) instead of CRecordset class then you will be able to pass the object to your VB ActiveX methods. I have included the link to samples in my previous post. These will help you get started. I hope this helps.
Sohail
Hii, If so please tell me how to do the connections and which header files i have to include please..I dont have idea adout ADO..I am using access database.will you tell me about connection and all..i am doing that only ok.. Please help me out... Thanks in advance, Savitri
-
Hii, If so please tell me how to do the connections and which header files i have to include please..I dont have idea adout ADO..I am using access database.will you tell me about connection and all..i am doing that only ok.. Please help me out... Thanks in advance, Savitri
-
Hii, If so please tell me how to do the connections and which header files i have to include please..I dont have idea adout ADO..I am using access database.will you tell me about connection and all..i am doing that only ok.. Please help me out... Thanks in advance, Savitri
Are you allergic to following directions? He's provided you with what you require...twice.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch