|
Nevermind, think i found the problem.
modified on Sunday, May 25, 2008 4:10 AM
|
|
|
|
|
You did? Let us know what was it. Something interesting?
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
was part my fault, a division by 0 that caused that , but its still wierd cose it works if i dont assing the value , but if i do , its messed up.
|
|
|
|
|
hi,
This is code i am using I've picked it from some where and I've changed it according to my requirements but its not inserting a new record. it gives error like attempt failed or record set is read only. I don't know i am using dynaset as an opening mode but still i get the error. kindly any one knows where i am going wrong.
CDatabase *mydb=new CDatabase;
ASSERT(mydb);
mydb->OpenEx("DSN=ff");
if(!mydb->IsOpen())
{
MessageBox("Unable to connect to Database. Please\ncontact your server administrator.", "Database Error", MB_ICONEXCLAMATION);
return;
}
CRecordset*myrec=new CRecordset(mydb);
ASSERT(myrec);
myrec->Open(CRecordset::dynaset,_T("SELECT s,p FROM e"),CRecordset::noDirtyFieldCheck);
if(!myrec->CanUpdate())
{
MessageBox("Database reports unable to update.", "Database Error", MB_ICONEXCLAMATION);
myrec->Close();
return;
}
if(!set.Open(CRecordset::dynaset,"SELECT * From e",CRecordset::noDirtyFieldCheck))
{
MessageBox("Unable to open database record. (SELECT * e)", "Database Error", MB_ICONEXCLAMATION);
set.Close();
return;
}
/*if (!set.CanAppend())
{
MessageBox("Database does not support adding records. Please\ncontact your server administrator.", "Database Error", MB_ICONEXCLAMATION);
set.Close();
}*/
set.MoveFirst();
while( !set.IsEOF() )
{
set.MoveNext();
}
int lRecCnt = set.GetRecordCount();
int newID=lRecCnt+2;
m_g=lRecCnt;
UpdateData(FALSE);
// Prepare for a new record addition.
try
{
set.MoveLast();
set.AddNew();
set.m_s = "Becky Dugan";
set.m_p = "Becky Dugan";
set.Requery();
set.SetFieldDirty(NULL);
set.Update();
}
catch(CException* pE)
{
char buf[256];
pE->GetErrorMessage(buf, 256, NULL);
AfxMessageBox(buf);
pE->Delete();
}
// Close Recordset
set.Close();
// Close Database
mydb->Close();
|
|
|
|
|
Why you have called Requery before actually adding the records,
Try doing this,
try
{
set.MoveLast();
set.AddNew();
set.m_s = "Becky Dugan";
set.m_p = "Becky Dugan";
if (!set.Update())
{
}
set.Requery();
}
Prasad
MS MVP - VC++
|
|
|
|
|
hey thr, its still not inserting the record.
|
|
|
|
|
how will trace program to conclude the symantic from this program
example :
how i will write code in vc++ to conclude the meaning of this simple program
main()
{
int j[5] ,k ,;
cout<<"welcome";
cin>>k;
k=k+5;
for(i=0;i<6;i++)
{
cout<< h[i];
}
cout << k;
}
thank you
|
|
|
|
|
sofia_111 wrote: how will trace program to conclude the symantic from this program
I didn't get you. You mean how to debug?
sofia_111 wrote: how i will write code in vc++ to conclude the meaning of this simple program
Please explain more clearly, so that we can help you.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
i want write code to compare between tow simple programs writen by c++
compare in syntx and symantic
in symantic compare i want to get the meaning for each program then compare between meaning.
word(meaning)take more than one possibility , here i nead to helping
i have idea : get the symantic(meaning) of program by trace the statments (cout cin exprission for if)and put the goal from statments in variables then compare between variables
if you have any other ideas and how it work , give me
thank you
|
|
|
|
|
As we say in Spain... you are explaining yourself as an open book.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
sofia_111 wrote: i want write code to compare between tow simple programs writen by c++
compare in syntx and symantic
You might be able to compare two "Hello World style" C++ programs by parsing and comparing with the help of String functions available - http://msdn.microsoft.com/en-us/library/bb759983(VS.85).aspx[^]. So that to some extend you can compare two programs by checking syntax. But still i'm afraid that whether it can be fault proof. It might work, only if you copy-paste the same program.
Then, comparing logic of two programs How can we compare the logic by simply analyzing the variables and statements?
OT: Your idea made me think of the "Oracle" character in Matrix Film.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
so.... you wish to create AI ????
|
|
|
|
|
exact, i want creat AI
may be exist syntax similarity but do not exist symantic similarity between programs
or reverse may be exist symantic similarity but do not exist syntax similarity between programs
|
|
|
|
|
also i want use rules to compute the similarity
the problem is(how get the semantic similarity between programs or at least how get the meaning of programs)
there are many ideas , but how i can imlement the idea?
|
|
|
|
|
note : i want to write code by vc++ to compare between two programs writen by c++
|
|
|
|
|
Hi Masters!
Can I add an "Edit Box" control to a list box (I mean the same as "Check Box" in CCheckBox)? In that case how to gain data from edit box?
Thnx So Much ...
|
|
|
|
|
Usef Marzbani wrote: Can I add an "Edit Box" control to a list box (I mean the same as "Check Box" in CCheckBox)?
do you really need such a control, instead list box with editable list items like this one [Editable ListBox^] may be useful.
modified on Saturday, May 24, 2008 11:26 AM
|
|
|
|
|
Yes! I need a:
("List Box" && "Edit Box" && "Check Box")
I realy need it.
|
|
|
|
|
|
Help me,please!!!
//?Part1:
BOOL DlgMain::InstallDLL()
{
LPTHREAD_START_ROUTINE lpRemoteThreadStartAddress
=(LPTHREAD_START_ROUTINE)::GetProcAddress(m_hDllInstance_Kernel32,"LoadLibraryW");
LPVOID pRemoteFunctionParam=
::VirtualAllocEx(m_hProcess,NULL,MAX_PATH,MEM_COMMIT,PAGE_READWRITE);
if (!pRemoteFunctionParam)
return FALSE;
if (!::WriteProcessMemory(m_hProcess,pRemoteFunctionParam,m_aChar_DllFullPath,MAX_PATH, NULL))
return FALSE;
HANDLE hThread=::CreateRemoteThread
(m_hProcess,0,0,
lpRemoteThreadStartAddress,
pRemoteFunctionParam,
0, 0);
if (!hThread)
return FALSE;
::WaitForSingleObject(hThread,INFINITE);
::GetExitCodeThread(hThread,(LPDWORD)&m_hModule_Dll);
::CloseHandle(hThread);
::VirtualFreeEx(m_hProcess, pRemoteFunctionParam,MAX_PATH,MEM_RELEASE);
return TRUE;
}
//Part2:
BOOL DlgMain::UninstallDLL()
{
LPTHREAD_START_ROUTINE lpRemoteThreadStartAddress
=(LPTHREAD_START_ROUTINE)::GetProcAddress(m_hDllInstance_Kernel32,"FreeLibrary");
HANDLE hThread=CreateRemoteThread
(m_hProcess,0,0,
lpRemoteThreadStartAddress,
(PVOID)m_hModule_Dll,
0, 0);
if (!hThread)
return FALSE;
::WaitForSingleObject(hThread,INFINITE);
CloseHandle(hThread);
return TRUE;
}
NOTE:LoadLibraryW in part1 not LoadLibraryA.Unicode is used!
Question:
Although part1 can work properly,part2 cannot!!
There is no exception when part2 run,but the function ExitInstance() that should be called in the dll won't no be called!!
Why?
Thanks for your help!!
|
|
|
|
|
why are you not using the unicode in second!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
I have created callback to receive MIDI messages.
While it can receive some messages, it is not receiving the full frame message(messages of fast forward/ rewind).
The callback function is:
void CALLBACK ReceiveMidi(HMIDIIN hMidiIn, UINT wMsg, DWORD<br />
dwInstance, <br />
DWORD wParam, DWORD lParam)
and I am opening MIDI input as:
mReturnCode = <br />
midiInOpen(&hdlMidiIn,uhInID,(DWORD)ReceiveMidi,(DWORD)NULL,CALLBACK_FUNCTION);
The "MIDI-OX" a MIDI tool can receive those messages.
What could be wrong with the callback for not receiving some kind of messages.
Some idea will be helpful in my debugging,
Thanks & Regards,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
If there is proper handling(receive the long message from MIDI IN), then all messages are coming.
Otherwise, only the first long message is coming.
Thanks & Regards,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
Hi all,
in VC++2005, combobox is editable,
i want to made it uneditable how can i do this.
please help me for this.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Setting CBS_DROPDOWNLIST style should do the trick.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|