|
Hi,
I have compiler error in using ::SQLConnect() method:
SQLRETURN SQLConnect(
SQLHDBC ConnectionHandle,
SQLCHAR * ServerName,
SQLSMALLINT NameLength1,
SQLCHAR * UserName,
SQLSMALLINT NameLength2,
SQLCHAR * Authentication,
SQLSMALLINT NameLength3);
It's OK if I hardcode the "MyDBSource" directly in the SQLConnect():
iReturnCode = ::SQLConnect(hDbc, (SQLCHAR*) "MyDBSource", SQL_NTS, (SQLCHAR*) "", SQL_NTS, (SQLCHAR*) "", SQL_NTS);
However, if my DBSource name is a CString, how I convert/cast to (SQLCHAR*)
in order to use it in the method?
Please help! Thanks
TQD
TQD
|
|
|
|
|
off the top of my head try:
(SQLCHAR*)(LPCTSTR)myString
"there is no spoon" biz stuff about me
|
|
|
|
|
Hi. I just installed VS2003 and started converting my programs from VS2002. All was woking fine till i reached a solution that, despite all my efforts, keeps poping this message:
"The dynamic link library MFC70D.DLL could not be found in the specified path..."
What is going wrong? Shouldnt VS detect that MFC70D.DLL is no longer used and that it should use MFC71D.DLL instead?
Thanks in advance.
|
|
|
|
|
Hi. I have write a simple c++ code that generates a digital sphere, which i will use next as a domain in a simulation algorithm. I create a text file that represents the sphere. To do this i'm writing in the text file z-layers cuts of the sphere. In the file suppose that 1 represents the solid sphere and 0 the outer.The code:
#include <stdio.h>
#include <iostream>
#include <math.h>
using namespace std;
int main(){
FILE *domainFile;
if((domainFile=fopen("sphere.txt","w"))==NULL){
cout<<"Cannot open file "<<endl;
system("pause");
="" exit(0);
="" }
="" int="" xmax="50;
" x0="xmax/2.0;"
="" ymax="50;
" y0="ymax/2.0;
" zmax="50;
" z0="zmax/2.0;
" radius="6;
" if(radius="">xmax || radius>ymax || radius>zmax){
cout<<"Error: define smaller radius"<
|
|
|
|
|
Hi all,
I've installed Visual C++ .net standard edition version 2002. I have some code done using the 2003 version.
Is it possible to build it using my version?. How can I do this?
Thanks,
Marcos
|
|
|
|
|
You might be able to step it back using this tool, then re-open it in VS2002.
|
|
|
|
|
Hi,
Thanks for the answer. But this program you suggest is to convert from visual 7 to visual 6.
I already have visual 7 (version 2002), but I need convert from visual 7.10 to visual 7.0... When I open the *.vcproj the error is: "Your project file version is 7.10. Visual Studio .NET can only load version 7.0 project files"
Any other idea?
Thanks,
Marcos
|
|
|
|
|
I didn't try, but that conversion program doesn't handle version 7.10 files? If it does, you could convert from v7.10 to v6.0, then re-open the v6.0 file in VS2002 and allow it to do the conversion for you.
If not ... I can't help you. Just figured it was worth a shot. Good luck.
|
|
|
|
|
If I have a Static label in MFC. I have a line of text in that I want different color(or different font size, bold etc) in each peice of text. How could I do that?
Anyone know?
Please help me
Love
|
|
|
|
|
Owner draw.
onwards and upwards...
|
|
|
|
|
Can you be more specific please......
thanks
Love
|
|
|
|
|
|
thanks. I will take a look
|
|
|
|
|
I've a program that calls other dialogs.
However, it appears that I can only call one dialog at any one time.
The main dialog is disabled until I exit the second dialog.
I want to be able to call many dialogs without the main dialog being disabled.
Suggestions much appreciated
Kind Regards
Caoimh
|
|
|
|
|
CMydialog *pDlg;
pDlg = new CMydialog;
pDlg->Create(CMydialog::IDD);
pDlg->ShowWindow(SW_SHOW);
Do this for other dialogs also.
For futher reference you can checkout what modeless dialogs are.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
I did a bit more research on modeless dialogs.
At the moment this code allows one to call a new dialog every time the button is pressed.
Would you by chance know of a routine which would solve this problem, i.e. I only want the dialog once, not many times.
|
|
|
|
|
Well you want many dialog box open and want only one of each dialog box to be open, its just a matter of programming logic.
CMyDialog *pDlg = NULL; //Some where global or in the theApp
if(pDlg == NULL)
{
pDlg = new CMyDialog;
pDlg->Create.....
...
}
When you destroy the window, i.e in OnDestroy
set pDlg = NULL;
hope this helps.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
You'll need to use modeless dialogs instead of modal.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
THANKS FOR ALL THE SUGGESTIOS. MUCH APPRECIATED
|
|
|
|
|
Hi,
I'm writing a MFC program at the momemnt. My program receives a string, but I want to output the hex version of the string to an edit box rather than the actual string.
Suggestions much appreciated
Kind Regards
Kevin
|
|
|
|
|
CString strEditText;
strEditText.Format("%x", atoi("2468"));
editctrl.SetWindowText(strEditText);
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
char *BufferToHexString(char *cpBuffer, int iBufferLength )<br />
{<br />
if (iBufferLength < 0)<br />
iBufferLength = strlen(cpBuffer);<br />
<br />
char *cpRetval = new char[(iBufferLength*2)+1];<br />
if (cpRetval)<br />
{<br />
unsigned char *cpSource = (unsigned char *)cpBuffer;<br />
unsigned int iChar;<br />
<br />
char *cpDest = cpRetval;<br />
<br />
for (int iLup = 0; iLup < iBufferLength; iLup++)<br />
{<br />
iChar = *cpSource;<br />
sprintf(cpDest,"%02X",iChar);<br />
<br />
cpSource++;<br />
cpDest += 2;<br />
}<br />
<br />
*(cpRetval+(iBufferLength*2)) = 0;<br />
}<br />
<br />
return cpRetval;<br />
}
onwards and upwards...
|
|
|
|
|
Do you mean a string representing a number? Or just the hex for an aribtrary string? Use atoi() for parsing a number. To convert an arbitrary string to a hex encoded string try something like this:
CString csYourString = "Something.";<br />
CString csHex, csEditContents;<br />
int i;<br />
for (i=0; i<csYourString.GetLength(); i++)<br />
{<br />
csHex.Format("%02X", csYourString.GetAt(i));<br />
csEditContents.Append(csHex);<br />
}<br />
csEditContents will then contain "536F6D657468696E672E"
Is this what you meant?
|
|
|
|
|
The append method won't work, not a member of CString, any suggestions on a workaround
|
|
|
|
|
Oh well, stuff like Append() is the whole reason for having a class like CString.
You can write your own append code then. Its only a few lines.
|
|
|
|