|
hi,
i want to develop one application in VC++ MFC ,which can insert & retrive data from a database(oracle), through a dll .The Dll is resposible for handling all database operation.
can any please help to work on that...
"EXE" + "DLL" + "DB"
1.how can i make a connection string for oracle database which is in remote system.
2.how can i handle DB opeartion in Dll.
i try with Dll , but it through error
send reply ,,,early
Try again and again,
At last you will say
I don't know the meaning for impossible.,.
-- modified at 11:37 Wednesday 7th June, 2006
|
|
|
|
|
maharaja pandian wrote: i try with Dll , but it through error
And that error would be what?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: And that error would be what?
You sure are nosey, aren't you
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
in the Dll file when i try to open DB using the below function it work but
when i try to open the recordset open i.e.,rsOpen() , it open a DataSource dialog screen will opened ,instead of executing a sql query
//////////////////////////////////////////////////////////////////////////
bool CDaoDB::dbOpen(CString strFilePathName)
{
try
{
db = new CDaoDatabase(NULL);
db->Open(strFilePathName);
return true;
}
catch(CDaoException* error)
{
delete db;
db = NULL;
LPTSTR errors = "";
error->GetErrorMessage(errors,100,NULL);
AfxMessageBox(errors);
return false;
}
}
bool CDaoRS::rsOpen(CString sql,CDaoDatabase* db)
{
CDaoTableDef *df;
try
{
if(db)
{
rs = new CDaoRecordset(db);
rs->Open(dbOpenDynaset,sql);
return true;
}
else
{
AfxMessageBox("There is no current database open.");
return false;
}
}
catch(CDaoException* error)
{
delete rs;
rs = NULL;
LPTSTR errors = "";
error->GetErrorMessage(errors,100,NULL);
AfxMessageBox(errors);
return false;
}
}
Try again and again,
At last you will say
I don't know the meaning for impossible.,.
|
|
|
|
|
maharaja pandian wrote: LPTSTR errors = "";
error->GetErrorMessage(errors,100,NULL);
This will likely fail as no memory has been made available for GetErrorMessage() to write the error message to.
maharaja pandian wrote: rs->Open(dbOpenDynaset,sql);
What is the value of sql ? Have you stepped into this method to see what is prompting the Open dialog to be displayed?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello everybody
i am working on MDI application using mfc, the user can have new file in the regular way, or by using a wizard. i have no problem in the regular way since the document , the view and the framework are attached to each other in the initinstance method in the application.
the problem is in the wizard way.
in the wizard i have to set the child frame hidden, and attach the document to the wizard, and to destroy the document after finishing the wizard.
any help or sample is appreciated
thanks alot
bye
|
|
|
|
|
hi,
Why you want to destroy the doc in the finish of your wizard .
After the wizard is over the view comes up is that the way your app works .
Regards,
FarPointer
Blog:http://farpointer.blogspot.com/
|
|
|
|
|
Hi
first thanks alot for your reply
actually in the finish page of the wizard i give the user the choice to end the document and save the results in a file, or to open the view to show him the data he already chose in the wizard to enable him to update them.
i also need to know how to hide the child frame, and how to associate the new document with the wizard
thanks
|
|
|
|
|
Hi ,
So let me get it straight :-
So the view should come ony when he does a finish in the wizard and that to depending on the checkbox valueand I also assume that the wizard mode only gets enabled after the first document is created .
if yes then you shouldnt take the pain to destroy the document since
OnFileNew() will destroy the prev document(and it should be called in the wizard finish) if any present and if the user preses cancel in between the wizard mode you can show the previous view.
So the problem comes were will you store the data during that process ,
I would suggest you to make an CContainer class which will hold the data and will stay in the App and in the finish after the document is created you set the container to the document and which will be deleted in its destructor .
Regards,
FarPointer
Blog:http://farpointer.blogspot.com/
|
|
|
|
|
Hi,
I want to use excel for displaying graph. I refer MSDN artical "Use MFC to Create a Microsoft Excel Chart (Q178783)". It almost satisfy my need. But it display the chart in same sheet in which values for drawing graph is. I want to display the graph in another chart. Simply stating in sheet1 I want value for plotting graph and in chart1 I want the graph of it.
I tried for it hard but faailed to do it can anyone help me out.
Mike
|
|
|
|
|
Hello everyone!
Look at this code:
for (x = strlen(fileName) - 1; x > 0; x--)<br />
{<br />
<br />
<br />
if (fileName[x] == '.')<br />
{<br />
<br />
newName = malloc(x-1);<br />
strcat(newName, fileName);<br />
return newName;<br />
}<br />
else<br />
printf("%c", fileName[x]);<br />
}
That code, seems like it'll work if I modify other parts a little bit, but that else statement is not needed anymore... But if I remove it, compile, and run the program, I get a Windows error:
Title: mythax.exe - Application Error<br />
<br />
The instruction at "0x7c93426d" referenced memory at "0x00000000". The memory could not be "read".<br />
<br />
Click on OK to terminate the program<br />
Click on CANCEL to debug the program
Is this a bug in the compiler or something? I'm using MinGW 3.4.2... Thanks!
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
Kixdemp wrote: strcat(newName, fileName);
What are you trying to do there ? Your newName string is not initialized (so it contains garbage) and you try to append data to it (which is also larger than the newName array). So you write outside the bounds of your array.
To use strcat, your destination string needs to be zero terminated and is not secure:
Security Note Because strcat does not check for sufficient space in strDestination before appending strSource, it is a potential cause of buffer overruns. Consider using strncat instead.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Your program seems to have problems not connected with else . First of all, you try to execute strcat , witch concatenates two strings, but you first string -- allocated with malloc -- actually does not contains a valid value. Probably, more appropriate here is strcpy .
It seems that your problem is to determine the file’s name without extension. In this case the size of the malloc-allocated buffer should be x , not x-1 , because a space for last null character is required.
Also consider other solutions for your problem. For instance, for finding the dot, you can avoid your loop and use strrchr function. For breaking a path into components, you can use splitpath function.
|
|
|
|
|
Kixdemp wrote: strcat(newName, fileName);
the problem is here
newName not having enough memory to contain the data in "filename"
newName can hold till "screenshot"
but the file name is trying copy whole string ("screeshot.jpg") to the newName. So a buffer overrun occured.
hope u clear.
try using strncpy.
Always keep in mind that "for a string buffer allocate buffersize +1" to hold the end null character. make sure that it is initialized to NULL to avoid unexpected behavior
SaRath.
"Don't Do Different things... Do Things Differently..."
Understanding State Pattern in C++
|
|
|
|
|
While Cedric has already provided you with an answer, I'm curious what this code snippet actually does. Is it separating a file's basename from its extension?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hey, thanks you all!
Now, I'm trying to use _splitpath() , since that's... umm... simpler. Look:
_splitpath("C:\\Documents and Settings\\Kixdemp\\Desktop\\Mythax\\screenshot.png", NULL, NULL, newName, NULL);
It crashes after that line. Does newName have to be initialized? Thanks!
PD: Does it have to be a full path? This is a command line app, and the user might just select a file in the program's dir...
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
Kixdemp wrote: Does newName have to be initialized?
No.
Kixdemp wrote: Does it have to be a full path?
Yes.
Kixdemp wrote: the user might just select a file in the program's dir...
Which is probably fine, if all you are interested in is the filename itself sans the path and extension.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
That is why I initially did not mention using _splitpath() because you were using MinGW.
If your goal is just to separate a filename from its path and extension, using strrchr() will come in real handy.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi
I am doing network programming in MFC. Problem is that i am trying to send a buffer to server using send(...) function. But there is an error. When i use WSAGetLastError() to check error code, it gives error code 0. Please can anyone tell me where can problem lie.
Thank you
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Aqueel wrote: Problem is that i am trying to send a buffer to server using send(...) function. But there is an error.
And that error would be what?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Yah i just wanted to know that in which scenerio, 0 is returned. what can be problem? I went on msdn. There is a list of error codes. But they are lables not integer values. How can i determine this one.
Thank you
We Believe in Excellence
www.aqueelmirza.cjb.net
-- modified at 10:33 Wednesday 7th June, 2006
|
|
|
|
|
Aqueel wrote: There is a list of error codes. But they are lables not integer values. How can i determine this one.
Have you looked in winerror.h ?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
After you obtained the error code with "DWORD error = WSAGetLastError(); " and stopped the program at a breakpoint, you can see a textual description of the error by adding the following value to Watch panel or QuickWatch window: "error,hr".
|
|
|
|
|
Sorry i debugged it and saw that error code is 183. What is that?
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|