|
The only think that you'd have to do is to install the ODBC implementation for SQL Server (usually comes with SQL Server installation), create the new DSN and change the connection string.
Depending on the versions of the DBMS you'd have to take care of the SQL implementation that they use because some statements couldn't be supported: transactions, ... but I don't think you'll have these kind of problems migrating from Access to SQL Server (on the other way probably).
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Click on the link below to 'My Articles' and check out my QuickQuery project. I'm using ODBC, and so far, it's worked with every type of database I've had on my system. It may not be exactly what you want (I think it was the first or second program I ever made in C++), but I hope it can help you in some way.
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
I'm looking for a non-MFC/WTL (ie. just Win32) menu class that implements the Office XP visual style. Everything on CodeProject seems to be MFC/WTL based.
Any suggestions ?
|
|
|
|
|
MFC CMenu just wrap a Win32 HMENU object...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi all
I am retrieving Hardware information by using WMI(Windows Management Instrumentation)classes.Here when I access any property of datetime data type then Run time error occurs. I am using VARIANT data type to take the values from WMI classes.
So Please tell me that how should I proceed to print values of datetime data type into the textbox.
Tanks.
|
|
|
|
|
provide the code snippet plz.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
The Code snippet is as follows
Here I am using Win32_OperatingSystem Class to access LastBootUpTime property and want to print it in text box, But it gives error.
Although I am able to take other properties of String data type of same class.
So please tell me solution.
IEnumWbemClassObject * pEnumObjectOS = NULL;
HRESULT hResOS;
BSTR strQueryBI = (L"Select * from Win32_OperatingSystem");
BSTR strQLOS = (L"WQL");
hResOS = pWbemServices->ExecQuery(strQLOS, StrQueryOS,WBEM_FLAG_RETURN_IMMEDIATELY,NULL,&pEnumObjectOS);
if(hResOS != S_OK)
{
MessageBox("Could not execute Query");
return;
}
ULONG uCountOS = 1, uReturnedOS;
IWbemClassObject * pClassObjectOS = NULL;
hResOS = pEnumObjectOS->Reset();
if(hResOS != S_OK)
{
MessageBox("Could not Enumerate");
return;
}
hResOS = pEnumObjectOS->Next(WBEM_INFINITE,uCountOS, &pClassObjectOS, &uReturnedOS);
if(hResOS != S_OK)
{
MessageBox("Could not Enumerate");
return;
}
VARIANT vOS;
//CString szStr;
BSTR strClassPropOS = SysAllocString(L"LastBootUpTime");
hResOS = pClassObjectOS->Get(strClassPropOS, 0, &vOS, 0, 0);
if(hResOS != S_OK)
{
MessageBox("Could not Get Value");
return;
}
SysFreeString(strClassPropOS);
_bstr_t bstrPathBIOS = &vOS; //Just to convert BSTR to ANSI
//char* strPath=(char*)bstrPath;
//COleDateTime dateTime(vBIOS.date);
// szStr=dateTime.Format("%H%M%S");
if (SUCCEEDED(hResOS))
SetDlgItemText(IDC_EDIT1,(char*)bstrPathOS);//MessageBox(strPath);
else
MessageBox("Error in getting object");
VariantClear( &vOS );
Thanks.
|
|
|
|
|
rajeevktripathi wrote:
BSTR strQueryBI = (L"Select * from Win32_OperatingSystem");
Am I miss something?? strQueryBI is never executed. You should be doing something like:
<br />
hResOS = pWbemServices->ExecQuery(strQLOS, strQueryBI ,WBEM_FLAG_RETURN_IMMEDIATELY,NULL,&pEnumObjectOS);<br />
Read this[^] if you haven't it may help you.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Hello,
Does:
char* pBuf = new char[nDataSize];
pBuf[nDataSize - 1] = '\0';
help?
If this does not help, could you specify your problem a little bit more clearly? Some code snippets might help also..
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hi
I am more specific here:
char* buff = new buff[5];<br />
buff[0] = 'a';<br />
buff[1] = '\0';
buff[2] = 'b';<br />
printf(buff);
if(buff)<br />
delete [] buff;
Any solutions?
Regards
Sreekanth Muralidharan,
Corporate Systems Consultant [Embedded Systems],
INDIA
|
|
|
|
|
Hello,
The '\0' character is a terminater. C runtime functions use that to determine the length of a string. Besides that, you cannot print is, since it is an invisible character. See the ascii table for more inforation.
You can display a space (I think that this is what you want) by doing the following:
buff[0] = 'a';
buff[1] = ' ';
buff[2] = 'b';
This should work.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
You won't be able to add a 0 to a C-string and still treat it as a C-string. However, there is nothing that prevents you from placing a 0 in a character array. You just can't use traditional C-string functions on it.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
for example:
strcpy - bad
memcpy - good
std::strinmg - bad
std::vector<char> - good
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Sreekanth Muralidharan wrote:
buffer of character
Instead of Buffer of Character use Buffer of BYTES this will solve your problem
"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
|
|
|
|
|
Being signed or unsigned has little to do with the problem other than preventing him from calling C-string routines. You can easily place a 0 in a buffer of characters (I've been doing it for years). You just have to be careful which routines and containers you use.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
char(acter) = byte = 8 bits
Er zit een korstje op mijn aars.
|
|
|
|
|
Abebe wrote:
char(acter) = byte = 8 bits
Yeap, you are right! I Will discuss with about that later! Stay Tuned
"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
|
|
|
|
|
Hi
There is no need for any head ache there.
Just take it this way and pump it through your serial port. It works !!
char * buff = new char[3];<br />
buff[1] = 0x01;<br />
buff[2] = 0x00;<br />
buff[3] = 0x02;<br />
if(buff)<br />
delete [] buff;
Regards
Sreekanth Muralidharan,
Corporate Systems Consultant [Embedded Systems],
INDIA
|
|
|
|
|
Hi Abebe,
Thanks for your reply.
I know a character is only 1 byte which cannot be accomodated there.
My problem is not that..
See this:
char * buff = new char[5];<br />
buff[0] = 'a';<br />
buff[1] = '\0';
buff[3] = 'c';<br />
printf(buff);
Else any other way to send a 00 through a serial port. I use a serial port monitor to monitor the data from the port. Suppose I have sent this string:
"Code Project"
The monitor should display 00.
Regards
Sreekanth Muralidharan,
Corporate Systems Consultant [Embedded Systems],
INDIA
|
|
|
|
|
'\0' is a terminator not space or EOL.
It is important to keep your terms clear as it leads to more confusion as your work becomes more complex.
If you have a terminator as a member then you must treat it as an array and control the length elsewhere, you cannot use normal string handling functions.
Elaine
The tigress is here
|
|
|
|
|
To acess a control...
* using GetDlgItem(IDC_) is better or using the control Variable m_Control is better?
regards,
Rookie
|
|
|
|
|
Hello,
It's just a matter of preference. Using the GetDlgItem() involves a lot of ugly typecasts and unnassecary code. Using the m_Control variable looks much more cleaner. I even think that it is slightly faster than the other method, since you already have a CWnd derived object. (Unless you use primitive types or CStrings for managing dialog data.)
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
thanx bob
regards,
Rookie
Installing MFC...2% complete.
|
|
|
|
|
You're welcome
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
as bob said, using GetDlgItem() each time you want to access a control add several function calls to your code that you could avoid.
but of course, using a member variable to store the CWnd* of a control is working unless you initialize it correctly (with... GetDlgItem() )
what i used to do personnaly is having a set of m_p???????? variables in my Dialog classes, that i initialize into OnInitDialog() with a set of GetDlgItem() calls...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|