|
shouvik.d wrote: Wat could b he possible errors.
The recordset isn't open.
The recordset has no records.
Can you show the code you use to open the recordset ad move to the first record?
|
|
|
|
|
I Actually am showing a set of records in a list box and on selection from the ListBox i move to that specific record but i'm not able to go to the first record as shown in the database only so i'm not able to move to the selected records. A certain Offset value is always there which also varies according to the number of records in the recordset.
void CLibManView::OnDblclkBooks() <br />
{<br />
m_pSet->MoveFirst();<br />
m_pSet->Move(lb->GetCurSel());<br />
MessageBox(CLibManView::GetStatus(m_pSet->m_Stat));<br />
}
My whole code is too big to attatch.
Shouvik
|
|
|
|
|
What type is m_pSet and what code do you call to open it?
Maybe it's not opened in the proper mode...
Mark
|
|
|
|
|
m_pSet is of type
<code>CLibManSet* m_pSet;</code>
whereas CLibManSet is of type
<code>class CLibManSet : public CRecordset</code>
its opened as
<code>m_pSet->Open(CRecordset::dynaset, (LPCTSTR)query,CRecordset::none);</code>
Shouvik
|
|
|
|
|
Thank you The source code helps!
Are you sure your "query" is valid and returning a set of records?
If it is working correctly and there are records returned then you should be positioned on
the first record when you "open" the recordset.
m_pSet->Open(CRecordset::dynaset, (LPCTSTR)query, CRecordset::none);
if (m_pSet->IsBOF() && m_pSet->IsEOF())
{
}
else
{
}
Also if Open() returns 0 then your database isn't connected/open.
No CDBException* being thrown, correct?
Mark
|
|
|
|
|
dear mark,
the code was extremely useful. As we know if a db contains atleast one record and the record pointer is on the First Record IsBOF() will return 0,
and indeed after using m_pSet->MoveFirst the value of IsBOF() is 0.
But now in MS ACCESS the order of the records are as follows
Ac_No Name Author Type Value Date Stat
<hr>
1111 Christmas Carol Charles Dickens 2 800 12/12/2006 2
1112 The Adventures of Hucklebery Finn Mark Twain 2 799 12/1/2005 1
1113 Chip DVD 06/06 Chip Magazine 1 100 1/6/2006 1
1114 Christmas Carol Charles Dickens 2 800 12/11/2006 1
1118 Last Christmas Eagles 1 299 1/4/2005 1
1119 The Adventures of Robinson Crusoe Daniel Dafoe 2 799 1/2/2002 1
<hr>
Even after issuing MoveFirst() the pointer is pointing to 1118.
weird
Note: the fields might be a bit mangled plz bear.
Shouvik
|
|
|
|
|
How are you opening the database? I think you need to not load the ODBC cursor library
If using CDatabase::Open() use FALSE for the bUseCursorLib parameter.
If using CDatabase::OpenEx() DON'T use the CDatabase::useCursorLib option in the dwOptions
parameter.
This is because you are using CRecordset::dynaset when opening your record set.
I still have no idea why MoveFirst() is not working correctly...
|
|
|
|
|
Hi,
I have an <name>.exe file. It should be invoked by the user who has admin privilages. How to do that in VC++?
Thanks and Regards,
Venkat
|
|
|
|
|
BOOL IsUserAdmin(VOID)
{
BOOL b;
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
PSID AdministratorsGroup;
b = AllocateAndInitializeSid(
&NtAuthority,
2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
&AdministratorsGroup);
if(b)
{
if (!CheckTokenMembership( NULL, AdministratorsGroup, &b))
{
b = FALSE;
}
FreeSid(AdministratorsGroup);
}
return(b);
}
From MSDN...
|
|
|
|
|
Are you asking how to verify permissions in code, or how to set the file permissions so that only users in the local/domain administrators group(s) can execute it?
The latter may be done by right-clicking on the file in explorer and configuring the necessary security settings.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hi James,
I am looking for the first one .. How to verify the permissions of the user who is invoking the exe file
Thanks and Regards,
Venkat.
|
|
|
|
|
You have the function on the 2nd reply. Returns TRUE if the user is local administrator.
|
|
|
|
|
Hi Cristian,
I am checking it out .
Thanks for ur help.
Regards,
Venkat
|
|
|
|
|
1. What is a static class?
2. What is static member?
3. What is static function?
4. What is static constructor?
5. How can we inherit a static variable?
6. How can we inherit a static member?
7. Can we use a static function with a non-static variable?
8. How can we access static variable?
9. Why main function is static?
10. How will you load dynamic assembly? How will create assesblies at run time?
11. What is Reflection?
12. If I have more than one version of one assemblies, then how will I use old version (how/where to specify version number?) in my application?
13. How do you create threading in.NET? What is the namespace for that?
14. What do you mean by Serialize and MarshalByRef?
15. What is the difference between Array and LinkedList?
16. What is Asynchronous call and how it can be implemented using delegates?
17. How to create events for a control? What is custom events? How to create it?
18. If you want to write your own dot net language, what steps you will you take care?
19. Describe the diffeerence between inline and code behind - which is best in a loosely coupled solution?
20. How dot net compiled code will become platform independent?
21. Without modifying source code if we compile again, will it be generated MSIL again?
22. How do you handle this COM components developed in other programming languages in.NET?
23. How CCW (Com Callable Wrapper) and RCW (Runtime Callable Wrappers) works?
24. What are the new thee features of COM+ services, which are not there in COM (MTS)?
25. What are the differences between COM architecture and.NET architecture?
26. Can we copy a COM dll to GAC folder?
27. What is Shared and Repeatable Inheritance?
28. Can you explain what inheritance is and an example of when you might use it?
29. How can you write a class to restrict that only one object of this class can be created (Singleton class)?
30. What are virtual destructures?
31. What is close method? How its different from Finalize and Dispose?
32. What is Boxing and UnBoxing?
33. What is check/uncheck?
34. What is the use of base keyword? Tell me a practical example for base keyword’s usage?
I.Zone@sify.com
|
|
|
|
|
You have a few things working against you here.
1: This is stuff that you can get answered on MSDN.
2: This sounds a lot like a homework assignment.
3: This is .Net stuff and you are asking in the VC++ forum.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Just go and buy a "c++ in 21days" because that is the answer you want.
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|
|
|
Except those are .Net questions...
Unless you are intentionally misdirecting the OP, which is even funnier!
Peace!
-- modified at 7:16 Wednesday 27th December, 2006
Wow! This was a reply to CaveFox... It got moved when the above post was created!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
ask a stupid question ...
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|
|
People here hate such kind of posting. Always ready to help you out of your problem, but not to do anybodies homework.
You are lucky , you are getting less flames, as lots of CP'ians are on vacation.
|
|
|
|
|
I agree with you people are on vacation, codeproject is privacy
|
|
|
|
|
I think you are new on c++ and I suggest see www.cplusplus.com maybe it some helpful for you
|
|
|
|
|
my application consists of a treecontrol in which i have displayed system files and folders in a tree control similar to the left hand side of Windows Explorer. i am able to copy the folder from the treecontrol and paste it on the explorer where ever we need.Also copy and paste operations are occuring with in the tree control.Now i have added unicode support to my application.The copy to clipboard function is failing.when i copy the folder from explorer i am able to paste it in the treecontrol.But when i tried viceversa i am getting an error message like "the file name you specified is not valid or too long.specify a different file name".how can i make the folder copy from the treecontrol.The code i used is ,
CDropFiles DropFiles;
if(!PrepareFileBuff(DropFiles))
{
return;
}
if (OpenClipboard())
{
BeginWaitCursor();
::EmptyClipboard();
HGLOBAL hMem = ::GlobalAlloc(GMEM_ZEROINIT|GMEM_MOVEABLE|GMEM_DDESHARE, DropFiles.GetBuffSize());
memcpy( (LPTSTR)::GlobalLock(hMem), DropFiles.GetBuffer() ,DropFiles.GetBuffSize() );
::SetClipboardData (CF_HDROP, hMem );
::CloseClipboard();
EndWaitCursor();
}
|
|
|
|
|
radhika28 wrote: memcpy( (LPTSTR)::GlobalLock(hMem), DropFiles.GetBuffer() ,DropFiles.GetBuffSize() );
Try using wmemcpy instead.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
i got the file size.but in win32 how would i convert it into string so i can append 'KB' after the converted string.
e.g.
494 size
then after append 'KB' it should be like 494KB.
thanks
amit
|
|
|
|