|
Do send a link when you find the cart-wheeling green eyed blond!
re reporting, one can also us Crystal Reports COM objects - the designer is not free, I think the rest is distributable...
|
|
|
|
|
Hi all,
I has been created one MFC extension dll called SRecordset.dll,which has been one .h file and one .cpp file
my dll .h file..
#pragma once<br />
#include afxdb.h<br />
<br />
<br />
class AFX_EXT_CLASS SRecordset : public CObject<br />
{<br />
DECLARE_SERIAL(SRecordset)<br />
<br />
<br />
public:<br />
SRecordset(void);<br />
<br />
public:<br />
~SRecordset(void);<br />
<br />
protected:<br />
CStringArray saDataContainer;<br />
short iNumFldCount;<br />
long iNumRec;<br />
int iRecCount;<br />
int iTotalSize;<br />
int iRecordState;<br />
int iLocalIndex;<br />
public:<br />
BOOL SSOpen(CDatabase &dbConnectedObj,CString sQuery);<br />
BOOL SSIsOpen(void);<br />
void SSClose(void);<br />
public:<br />
BOOL SSIsBOF(void);<br />
BOOL SSIsEOF(void);<br />
public:<br />
void SSGetFieldValue(int iIndex,CString &FldValue);<br />
short SSGetFieldCount(void);<br />
long SSGetRecordCount(void);<br />
long SSGetCurrentRecordCount(void);<br />
public:<br />
void SSMoveNext(void);<br />
void SSMovePrevious(void);<br />
void SSMoveFirst(void);<br />
void SSMoveLast(void);<br />
public:<br />
virtual void Serialize(CArchive& ar);<br />
};
I has been created my dll successfully. But, it won't support to the client application,it will be thrown only one linker error, when i call rather the SSOpen(CDatabase &dbConnectedObj,CString sQuery) function only, not other function calls from my above the class during the runtime.
Here the part of code from my client app...
void CtestingDlg::OnBnClickedOk()<br />
{<br />
<br />
<br />
CDatabase db;<br />
CString sIp,sDb,sPwd,sConn,sPort,sUn;<br />
sIp="192.168.2.17";<br />
sPort="5432";<br />
sPwd="fasp";<br />
<br />
<br />
try<br />
{<br />
sConn = "DRIVER={PostgreSQL ANSI};SERVER=" + sIp + ";port=" +<br />
sPort + ";DATABASE=" + sPwd + ";UID=" + sPwd + "WD=" + sPwd + ";";<br />
db.OpenEx(sConn);<br />
AfxMessageBox("Success");<br />
}<br />
catch(CDBException *e)<br />
{<br />
MessageBox("Database Connection Refused."+e->m_strError,"DataBase<br />
Connection Error",MB_OK|MB_ICONERROR);<br />
e->Delete();<br />
<br />
}<br />
<br />
<br />
SRecordset set1;<br />
<br />
set1.SSOpen(db,"select name from master;");<br />
set1.SSGetFieldCount();<br />
set1.SSGetRecordCount();<br />
set1.SSClose();<br />
<br />
OnOK();<br />
}
where set1.SSOpen(db,"select name from master;"); is the problem
Error is.....
testingDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall SRecordset::SSOpen(class CDatabase &,class ATL::CStringT > >)" (__imp_?SSOpen@SRecordset@@QAEHAAVCDatabase@@V?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@@Z) referenced in function __catch$?OnBnClickedOk@CtestingDlg@@QAEXXZ$0
please note that my class is derived from CObject class meanwhile CDatabase is also derived from CObject class...i think may be this is the reason for my problem?
please help me!
|
|
|
|
|
Did you provide a body for this function ?
|
|
|
|
|
yah sure..
this is my function body..
IMPLEMENT_SERIAL(SRecordset,CObject,VERSIONABLE_SCHEMA | 2)<br />
<br />
BOOL SRecordset::SSOpen(CDatabase &dbConnectedObj,CString sQuery) <br />
{<br />
if(!dbConnectedObj.IsOpen())<br />
return FALSE;<br />
<br />
CRecordset rsObject(&dbConnectedObj);<br />
<br />
CString sValue;<br />
<br />
if(!rsObject.Open(AFX_DB_USE_DEFAULT_TYPE,sQuery)) <br />
return FALSE;<br />
<br />
iNumFldCount = rsObject.GetODBCFieldCount(); <br />
<br />
iNumRec = 0; <br />
<br />
while(!rsObject.IsEOF())<br />
{<br />
rsObject.MoveNext(); <br />
iNumRec++; <br />
}<br />
<br />
iTotalSize = iNumFldCount * iNumRec; <br />
<br />
saDataContainer.SetSize(iTotalSize); <br />
<br />
rsObject.MoveFirst();<br />
<br />
iRecCount = 0;<br />
<br />
while(!rsObject.IsEOF())<br />
{<br />
for(int ic=0; ic < iNumFldCount; ic++)<br />
{<br />
sValue = "";<br />
rsObject.GetFieldValue(ic,sValue);<br />
saDataContainer[iRecCount] = sValue; <br />
iRecCount++;<br />
}<br />
<br />
rsObject.MoveNext();<br />
}<br />
<br />
rsObject.Close();<br />
dbConnectedObj.Close();<br />
return TRUE;<br />
<br />
}
|
|
|
|
|
I am not sure: check that for both projects you are using the same unicode settings (unicode needs to be defined for both or for none of them). Maybe it is due to the fact that for one of the project, CString will be defined as CStringA (non unicode) and for the other, CString will be defined as CStringW (unicode). Thus, a linker error.
But I'm not sure at all.
|
|
|
|
|
ok fine you are correct my dll is unicode character set but my client is non unicode set,now its working fine. thank you.
-- modified at 6:07 Thursday 10th May, 2007
|
|
|
|
|
I am attempting to POST to a HTTPS server all is apparently S_OK but I get a STATUS code returned of 12019 and no ResposeText! Is this because MS XMLHTTP40 does not cater for certificates? If so any idea how I can POST my XML to the HTTPS server and successfully receive responses???
|
|
|
|
|
I have added:
hr = pXMLHTTPReq->setOption( (MSXML2::SERVERXMLHTTP_OPTION)2, 13056 );
and now get the following response:
<code>STATUS CODE: 405
Response Text: <HTML><HEAD><TITLE>Method Not Allowed</TITLE></HEAD><BODY><H1>Method Not Allowed</H1>An error occurred.</BODY></HTML>
All Response Headers: Server: Sun-ONE-Web-Server/6.1 Date: Thu, 10 May 2007 10:10:58 GMT Content-length: 124 Content-type: text/HTML Allow: Head, GET Connection: close</code>
I would very much appreciate if anyone could shed any light on how to resolve this.
|
|
|
|
|
This is getting rather anoying!
I have changed:
hr = pXMLHTTPReq->open( "POST", bstrURL, VARIANT_FALSE );
to:
hr = pXMLHTTPReq->open( "post", bstrURL, VARIANT_FALSE );
This changes the returned STATUS code from 405 "Method Not Implemented" to 501 and the resposeText I now get is: "This server does not implement the requested method". How else other than using the "post" method do we SEND XML to a HTTPS service?
|
|
|
|
|
i got crash when tried to close the dialog which is called by domodal
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
How are you trying to close it?
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
Can you show code snippet that you got error?
|
|
|
|
|
yes this is the code
BOOL CMyConnCustomInstall::OnCUSTInstall()
{
int MyConnecCheck = 0, ChatCheck = 0, PwdMgr = 0, Response = 0, nStatus = 0;
int EKMyConnDLSuccess = 0, EKChatDLSuccess = 0, EKPwdMgrDLSuccess = 0;
CFileOperation *fileOpr = new CFileOperation();
m_Downloading = 1;
BeginWaitCursor();
if(m_Ekpass==1)
{
//Check if the Tools are already installed
PwdMgr = ToolExistCheck(EKPWDMGR, "EKPassword Manager");
//Downloading
if(PwdMgr)
EKPwdMgrDLSuccess = Download(EKPWDMGR, "EKPassword Manager");
//Installing
if(PwdMgr && (EKPwdMgrDLSuccess == DLSUCCEED))
{
nStatus = InstallTools(EKPWDMGR, "EKPassword Manager");
if(nStatus == DLSUCCEED)
InstallPackages(EKPWDMGR, "EKPassword Manager");
}
this->EndDialog(0);
}
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
Why you use of this code
CFileOperation *fileOpr = new CFileOperation();
|
|
|
|
|
Hi,
have you tried to insert your own "stop"-points with AfxMessageBox () to see where it exactly crushes?
And, on the other hand...
this->EndDialog(0);
void EndDialog( int nResult );
Parameters
nResult: Contains the value to be returned from the dialog box to the caller of DoModal.
Why don't you use a simple "return 0;" ??
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
I got some crashes in the same moments.
In my case it was because I tried to free things in the destructor of the dialog and, as the window doesn't exists at that moment... I got assertions while trying to delete contents of members.
Maybe...
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
but i got this only in release mode.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
|
deeps_cute wrote: i got crash...
Which is fairly meaningless. What exactly is happening?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
deeps_cute wrote: i got crash when tried to close the dialog which is called by domodal
have you handlled all dynamic memory allocation and Thread closure before closing of dialog box!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi all,
I have a requirement in which i need to get all the unique user's records from my table. I tried the following query in the Open() function. but it is throwing an error saying:
---------------------------
TestDB
---------------------------
Error retrieving record.
---------------------------
OK
---------------------------
I'm using a SDI application with ODBC connectivity.
m_pSet->Open(CRecordset::dynaset , _T("SELECT User FROM UserPass GROUP BY User;"));
Thanks in Advance.
Rajesh
|
|
|
|
|
Rajesh_Parameswaran wrote: m_pSet->Open(CRecordset::dynaset , _T("SELECT User FROM UserPass GROUP BY User;"));
If you suspect that the GROUP BY clause is the culprit, have you tried the query without it?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
The definition of structure xdr_pos in XDR.h file is like this
typedef struct {
enum xdr_op x_op; /* operation; fast additional param */
struct xdr_ops {
bool_t (*x_getlong)(); /* get a long from underlying stream */
bool_t (*x_putlong)(); /* put a long to " */
bool_t (*x_getbytes)();/* get some bytes from " */
bool_t (*x_putbytes)();/* put some bytes to " */
u_long (*x_getpostn)();/* returns bytes off from beginning */
bool_t (*x_setpostn)();/* lets you reposition the stream */
long * (*x_inline)(); /* buf quick ptr to buffered data */
void (*x_destroy)(); /* free privates of this xdr_stream */
} *x_ops;
caddr_t x_public; /* users' data */
caddr_t x_private; /* pointer to private data */
caddr_t x_base; /* private used for position info */
int x_handy; /* extra private word */
} XDR;
The declaration of variable of the type xdr_ops in the file xdrposix.c is like this
static struct xdr_ops xdrposix_ops;
But i am getting compiler error like this
Error 7 error C2079: 'xdrposix_ops' uses undefined struct 'xdr_ops' d:\cougar_io_development\cougar\core\libraries\cplusplus\dlls\andi.vs8\xdrposix.c 284
What is the reason? How to resolve this?
Regards, Eswari
|
|
|
|
|
C++ or C compiler?
See here [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
thank you. it worked. Basically the dll is written in c. But i am porting to VC++2005. But i am getting different error.
Error 12 error C2197: 'int (__cdecl *)(void)' : too many arguments for call d:\cougar_io_development\cougar\core\libraries\cplusplus\dlls\andi.vs8\xdrfloat.c 88
for the line (XDR_PUTLONG(xdrs, (long *)fp));
where the definition is like this in the header file.
#define XDR_PUTLONG(xdrs, longp) \
(*(xdrs)->x_ops->x_putlong)(xdrs, longp)
one more doubt. The same dll i am able to built in debug mode successfully without any code changes. Why changes are required in release mode.
Any help is appreciated.
|
|
|
|