|
Hi,
I want write a SQL to insert records into my table(The table has
a large amounts of fields,more than 100).
The SQL is a CString, but it is too big and exceeds the
maxium length of a CString. Please help me how can I
create a string with any huge length? Code examples would
be more appreciated.Or any other method?
Thanks a lot.
wang
wang
|
|
|
|
|
|
Thats a good advice indeed
MS
|
|
|
|
|
How about you create a CString for every row in the table instead!
Then you can use CStringArray
|
|
|
|
|
Since it's quite difficult to write a 2GB query(!), I guess you are writing something like
CString SQLString (a string longer than 2048 chars);
If this is your code, there is not a problem related to CString, but it is a limit of the compiler: in vc6 a string cannot be longer than 2048 characters.
So, you could simply try
CString SQLString;
SQLString="First part of query smaller than 2048";
SQLString+="Second part of query";
and so on...,
|
|
|
|
|
Hi, guys:
I've developed a dll which need several other dll's. It's OK when I "regsvr32 mydll.dll" and it works perfectly. But, the releaseminsize version give me "LoadLibrary(mydll.dll) failed - unspecified error".
What's wrong with the releaseminsize version ? How can I get it working?
TIA
-gusd
|
|
|
|
|
|
suninwater wrote:
It's OK when I "regsvr32 mydll.dll" and it works perfectly.
Is this a "debug" version?
suninwater wrote:
But, the releaseminsize version give me "LoadLibrary(mydll.dll) failed - unspecified error".
Does this happen with all "release" versions?
|
|
|
|
|
Hi! I have one question. Where I can find reference of classes and methods which are included in the adodc.cpp and datagrid.cpp files with Microsoft ADO and Data Grid components.
|
|
|
|
|
Dear All,
I am developing an application in MFC VC++ Version 6.0 for Windows 2000.
I need to restore all the files from my recycle bin. Is there any API provided for restoring Recyclebin data ?
Or any alternative way out to restore the files present in Recycle bin ?
Please send your useful suggestions.
Feel free to ask any further queries in this regards,
Thanks
Rohit Dhamija
|
|
|
|
|
|
hi Dominik
Thanks a lot for replying. I have seen this code, but i am encountering two problems:
1)The program is throwing following error:
error: afximpl.h doesnot exist no such file
2) I am not able to understand out how it is restoring the file(ie. which API he is using or what method is being used)
....
Once the program is run then i can debug and make it out how the program is restoring the file.
Can you help me out ?
Thanks
|
|
|
|
|
1) See here.
2) It is cleverly using the menu from Windows' Recycle Bin. When you right-click on a file in the Recycle Bin, notice the context menu that appears. Step through the CRecycleBinDlg::ExecCommand() function to see how a file is "undeleted."
Line 635 gets a PIDL to the Recycle Bin folder. Then line 782 gets the context menu of this PIDL. The loop at line 809 searches for the verb (e.g., undelete). Once found, line 858 executes that verb.
|
|
|
|
|
This must be a silly problem
I add a new .c or .cpp file to my project with its own .h which it includes:
logmsg.c:
...
#include "logmsg.h"
...
I get:
logmsg.cpp(236) : fatal error C1010: unexpected end of file while looking for precompiled header directive
???
|
|
|
|
|
You must either add
#include "stdafx.h"
BEFORE your include, or change the cpp file "Settings" -> "Precompiled Headers" to "Not using precompiled headers".
Cheers,
Andy
|
|
|
|
|
|
Hi...
i am doing a project which makes use of C to create a structure of let's say
struct Data
{
int age;
char gender;
};
when in C, i use sizeof(Data) to pass the value to Visual Basic to write and update the structure, it gives error and after debugging, it bounds to the sizeof() problem as in C++, this sizeof(Data) returns 8 and not 5 while in VB, it gets 5.
Anyone has a solution. i read up the help file and it says cos of trailing and padding. if i change to this
struct Data1
{
char gender;
};
the sizeof(Data) returns me 1.
|
|
|
|
|
The Intel processors are most efficient when accessing data that is located at memory addresses that are a multiple of eight (I think). This is common with many microprocessors.
Visual C++ defaults to locating structure members on 8-byte address boundaries. Each data element of a structure (or class) will be located at next memory address that is a multiple of 8. This can be changed in the project settings under C/C++, Code Generation.
You can also get fine grained control using #pragma directives in your code. This might be a better approach since you could pack your structures passed to VB on 1-byte boundaries and leave all the internal stuff at the default of 8 which is much more efficient.
Here is a sample:
<br />
#pragma pack(push, test)<br />
#pragma pack(1)<br />
struct Five<br />
{<br />
int i;<br />
char c;<br />
};<br />
#pragma pack(pop, test)<br />
<br />
struct Eight<br />
{<br />
int i;<br />
char c;<br />
};<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
Five five;<br />
Eight eight;<br />
cout << sizeof(five) << endl;<br />
cout << sizeof(eight) << endl;<br />
<br />
return 0;<br />
}<br />
Hope that helps.
Brad
|
|
|
|
|
Thanx Brad. it solves my problem...
|
|
|
|
|
Hello,
I have a question on how command line args work with CreateProcess.
Lets say I want to open a specific Word document. I set a string, program, to
program = " \"C:\\Program Files\\Microsoft Office\\Office10\\WINWORD.EXE\" \"C:\\Docs\\Open This File.doc\" ";
Then I do:
<br />
if( !CreateProcess( <br />
NULL
program.GetBuffer(0),
NULL,
NULL,
FALSE,
0,
NULL,
workingDirectory,
&si,
&pi)
) <br />
where working directory is correctly set.
Now, this runs Word fine and opens the doc.
However, I tried to run another file, a game (C&C Generals).
I wanted the game to run with the flags -quickstart -xres 1280 -yres 1040.
So, I set program:
program = " \"C:\\Games\\C&C Generals\\Generals.exe\" \"-quickstart -xres 1280 -yres 1040\" ";
and did the same thing with CreateProcess. But now, the args are ignored.
I tried to fix it and what worked was when I got rid of the quotes around
-quickstart -xres 1280 -yres 1040 and then it worked fine.
If I get rid of the quotes around C:\Docs\Open This File.doc then Word doesnt open the file correctly.
So, here is my question:
When do I need to use quotes around the arguments? Do I only use quotes if the arg is another file and not when they are flags for the executable?
If my question is not clear, please let me know.
Thanx for the help,
-Flack
|
|
|
|
|
Use the quotes to delimit a single argument. Without quotes, spaces delimit arguments. If a single argument has an embedded space, put the whole argument in double quotes.
You needed the quotes for the Word document because the file name had embedded spaces.
For the game, there are actually 5 arguments:
- -quickstart
- -xres
- 1280
- -yres
- 1040
You wrapped all five in one pair of quotes, so this was interpreted by the program as a single argument.
Hope that helps.
Brad
|
|
|
|
|
Hello, everyone!
I think in C/C++ programming, you need to define a variable as
extern but there is no need to define a function as extern. The only
useful qualifier keyword used before a function is "static". And I
think you can use "#include .h" when you want to use other functions
defined in other files.
Am I correct?
regards,
George
|
|
|
|
|
For free functions (C-ctyle functions), static means the function is not visible outside of the compilation unit (normally the .c or .cpp file).
The default is extern which means the function is visible - when an appropriate declaration is provided - outside of the compilation unit.
Brad
|
|
|
|
|
Thanks, Brad buddy!
Can you show me a case when "extern" keyword is a must? I think if we use
"#include .h" method, no extern functions are needed to use.
regards,
George
|
|
|
|
|
extern is never required since it's the default i.e. if you want the function visible outside of the compilation unit specify extern or specify nothing. Both have the same meaning.
Brad
|
|
|
|