|
The database is in the same computer where my program resides.Actually I am fetching the records from the database and placing them on a grid control.
The code for fetching the records is as follows:
_ConnectionPtr pConn;
_RecordsetPtr pRecSet;
TCHAR strQuery[5000];
HRESULT hr;
CString strConn;
hr=pConn.CreateInstance(__uuidof(Connection));
if (SUCCEEDED(hr))
{
}
else
{
AfxMessageBox(_T("Failed to establish connection"));
return;
}
strConn.Format(_T("Provider=Microsoft.Jet.OleDB.4.0;Data source=%s;"),strPath);
hr=pRecSet.CreateInstance(__uuidof(Recordset));
if (SUCCEEDED(hr))
{
}
else
{
AfxMessageBox(_T("Recordset creation failed"));
return;
}
BSTR bstrconn = strConn.AllocSysString();
BSTR bstrNull = NULL;
hr = pConn->Open(bstrconn,bstrNull,bstrNull,adModeUnknown);
if(FAILED(hr))
{
AfxMessageBox(_T("Failed to open database connection"));
return;
}
try
{
VARIANT v;
VariantInit(&v);
v.vt=VT_BSTR;
_stprintf(strQuery,_T("Select * from MyDatabase"));
CString str;
CString strColName;
while(!(VARIANT_TRUE == pRecSet->EndOfFile))
{
for(int i=0;i<columnnames.getsize();i++)
{
=""
="" strcolname="ColumnNames.GetAt(i);
" v.bstrval="strColName.AllocSysString();
" fieldsptr="" fp;
="" fp="pRecSet-">Fields;
_variant_t var;
VariantInit(&var);
var= fp->GetItem(v)->GetValue();
str = var.bstrVal;
AfxMessageBox(str);
}
pRecSet->MoveNext();
}
pRecSet->Close();
pConn->Close();
}
catch()
{
.......
}
Taruni
|
|
|
|
|
Taruni wrote: AfxMessageBox(str);
Displaying a messsage box 1500 times will undoubtedly cause a delay.
Have you consulted any of these articles?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
i dont know how to use sax2 parser with c++ can any body help me. what should i installed , and how could i use it to read my XML file?
please give me the detail for SAX2, if possible send me link....
Amit
|
|
|
|
|
|
Thank you
|
|
|
|
|
|
Hi,
How to kill a process given a process ID
Thanks and Regards,
Venkat
|
|
|
|
|
|
|
Killing a process should only be a last resort and can be dangerous; better to ask it to close down. That said, you can use the TerminateProcess API to kill a process given a HANDLE to the process. The OpenProcess function can be used to get a process HANDLE from its id.
Steve
|
|
|
|
|
I have made a simple MFC exe..in VS 6.0...which has all the resources in the english language...
I have to create a Resource Only DLL in some other language say..German...so...when i click on a resource and insert a copy of it in German language..(Insert -> Resource copy....which..opens a Dialog where I can choose the resource language)....then the resource still has the text in english...but the microsoft articles say it should be translated to German.....(Point no.8 in the article http://support.microsoft.com/kb/198846)
The other way is ....I create a fresh MFC exe choosing German language from the beginning and copy its German Resources script file to the english mfc exe..
Wats going wrong in the former..approach....plzzz help me out..
Thnx...
...A Master Programmer may or may not be the master of the programming language grammar...
|
|
|
|
|
To use a resource only dll, you need to create a dll that contains all of your string resources an whatever else for each language. Each dll should have same 'type' header file, which means each ID for the resource should be the same for each language. All your exe needs to do is load the appropriate dll for the specified language then use the string ID's as normal.
Is it possible you are forgetting to update the current windows when hot-switching between languages?
|
|
|
|
|
Thnx for the response...
jas tell me one simple thing...
This is my basic doubt
If I right click on a resource in the Resource view and then on 'Insert copy' and choose some other language...say German..then a copy of that resource will be added...but will it have be in English or German.....? Please do me the favor by checking this thing on ur machine...
On my VS 6.0...it always comes in English....they don't get translated to German on the fly...
All this while I do not change the language from Control Panel->Regional Setting n langs..to some other language...it is english...always...
And, wat language hot switching hve u referred to in ur response......?
Maybe, I am missing some locale setting change...
Thnx...
-- modified at 13:47 Thursday 1st February, 2007
...A Programmer may or may not be the master of the programming language grammar...
|
|
|
|
|
When you choose the language while adding resources, it will not perform any translation. Infact, all it will do is add the new resources under a different codepage. You will need to translate all the text strings yourself. Also, when using two languages and two codepages in the same resource, you will still need to add code to your exe to be able to switch between the two.
Whenever I build a multi language app, I will always create a dll for each language. All the dll's need to contain are the dialogs and strings, with the same ID's, translated into various languages. Then in the exe, I will add code to scan the dll folder hence checking for what languages are available. I then dynamicaly link to a single dll, depending on the OS's language.
This way, I can add more languages simply by creating a new dll. The exe is also able to hot switch between languages by simply unloading the dll and loading a new one in it's place.
|
|
|
|
|
Hi....
I think I got my answer that there will be no automatic translation and I have to edit them manually....ok...rest of the theory is clear to me..like using that dlls n all...
Well...thanx a lot for the answer....
...A Programmer may or may not be the master of the programming language grammar...
|
|
|
|
|
How to show Video Preview from Video Packets in VC6?
OR How to use VLC in VC6? Is there any ActiveX Control of VLC that can be used in VC6?
|
|
|
|
|
|
See here[^] if its helpfuls
|
|
|
|
|
Hi
All
I am doing multilingual application in which i am loading string from DLL in client application, but i want to set this string to Static text of Dialog box. So how can done it.
Thanks and Regards
Atul Mahajan
Atul
|
|
|
|
|
M. Atul wrote: but i want to set this string to Static text of Dialog box. So how can done it.
How far have you done.
|
|
|
|
|
This forum is here to help, not give you answers to homework assignments. Perhaps if you could show us what you have already tried we would be able to help you a little more.
|
|
|
|
|
M. Atul wrote: i want to set this string to Static text of Dialog box. So how can done it.
With SetWindowText() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Do you want to set text you can use of SetWindowText or WM_SETTEXT
|
|
|
|
|
I have a code as follows:
CSpanLoad *pBDLd;
CSpanLoad *pA3DLd;
---
---
--
pBDLd = pA3Ld;
//this assignment has to call the function:
void CSpanLoad::operator=( const CTRYObject &src ).
CTRYObject is inherited from CObject class.But now the assignment is not calling void CSpanLoad::operator=( const CTRYObject &src ) instead is calling the operator= of CObject.
If i give *pBDLd = *pA3Ld then it shows the compilation error as:
error C2248: 'CObject::operator =' : cannot access private member declared in class 'CObject'"
see declaration of 'CObject::operator ='
see declaration of 'CObject'
This diagnostic occurred in the compiler generated function 'CPtrArray &CPtrArray::operator =(const CPtrArray &)'
Why the error?
**NOTE:
*pBDLd = *pA3Ld was working in VC6 properly without error.The error came in VS2005(.net).For correcting that only i changed into
pBDLd = pA3Ld;//which is not working as intended
Plz help..
Thanks and Regards
|
|
|
|
|
sheetal_06 wrote: If i give *pBDLd = *pA3Ld then it shows the compilation error as:
In this case assignment operator for CSpanLoad will be called.
|
|
|
|