|
Yes,i want to embed notepad window into a dialog.
Sherin Iranimose
|
|
|
|
|
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
|
|
|
|
|
shouvik.d wrote: Even after issuing MoveFirst() the pointer is pointing to 1118
Have you queried for all these records ? If yes, have you used any ORDER BY clause ? Can you show that code ?
|
|
|
|
|
can u let me know one thing.
if in access i'm getting that specified view doesn't make sure that internally the record is stored in that order only.
is it so. then this clarifies all my query.
i mean i've entered all my recs in an ascending order format by Ac_No as primary key. So the disp is also in ascending order of the values of Ac_no. does that not mean the internal record storage order is the same
Shouvik
|
|
|
|
|
shouvik.d wrote: if in access i'm getting that specified view doesn't make sure that internally the record is stored in that order only
Not sure.
|
|
|
|
|
Here's my code.
plz help u've always been to my rescue first time;)
<code>m_pSet->Close();
query="Select * from Book where Name like '%"+name.Left(5)+"%' AND Author LIKE '%"+auth.Left(5)+"%' Order By Ac_No" ;
m_pSet->Open(CRecordset::dynaset, (LPCTSTR)query,CRecordset::none);
m_pSet->MoveFirst();
do
{
Item.Empty();
name=m_pSet->m_Name;
auth=m_pSet->m_Author;
Item=m_pSet->m_Ac_No+"\t"+name+"\t"+auth+"\t"+CLibManView::GetStatus(m_pSet->m_Stat);
lb->AddString(Item);
m_pSet->MoveNext();
}while(!m_pSet->IsEOF());
</code>
Hope this is suff 4 u
Shouvik
|
|
|
|
|
shouvik.d wrote: query="Select * from Book where Name like '%"+name.Left(5)+"%' AND Author LIKE '%"+auth.Left(5)+"%' Order By Ac_No" ; m_pSet->Open(CRecordset::dynaset, (LPCTSTR)query,CRecordset::none);
I hope this gives you expected no. of records.
Use CRecordset::m_strSort to sort the records.
|
|
|
|
|
I tried but funniest part is its adding the records instead of sorting them so i used a query instead.
Shouvik
|
|
|
|
|
shouvik.d wrote: I tried but funniest part is its adding the records instead of sorting them
Can you show code ? what you have tried ?
It can be,
m_pSet->Open();
m_pSet->m_strSort = "par, par1";
m_pSet->Requery();
|
|
|
|
|
But the records are already sorted.
Shouvik
|
|
|
|
|
shouvik.d wrote: But the records are already sorted
By what ? If it is sorted by Ac_No , MoveFirst() should point to correct record in order.
|
|
|
|
|
I said its all entered in Ascending order.
So the retrievel is sorted irrespective of anything.
Still the pointer remains stuck at 1118. i'm g:(ing nuts
Shouvik
|
|
|
|
|
Try this instead:
m_pSet->Close();
query = "Select * from Book where Name like '%" + name.Left(5) + "%' AND Author LIKE '%" + auth.Left(5) + "%' Order By Ac_No";
m_pSet->Open(CRecordset::dynaset, query, CRecordset::none);
while(! m_pSet->IsEOF())
{
name = m_pSet->m_Name;
auth = m_pSet->m_Author;
Item = m_pSet->m_Ac_No + "\t" + name + "\t" + auth + "\t" + CLibManView::GetStatus(m_pSet->m_Stat);
lb->AddString(Item);
m_pSet->MoveNext();
}
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Sorry David
Still stuck at 1118. cant trace out the prob at all. I think the internal pattern of storage is so that 1118 is the first record.
Success makes life easier. It doesn't make living easier.
SHOUVIK
|
|
|
|
|
Since nothing worked out i changed the whole structure
its like this
void CLibManView::OnDblclkBooks()
{
CString str;
lb->GetText(lb->GetCurSel(),str);
m_pSet->Close();
query = "Select * from Book where Ac_No='"+str.Left(4)+"'";
m_pSet->Open(CRecordset::dynaset, (LPCTSTR)query,CRecordset::none);
if(m_pSet->IsBOF() && m_pSet->IsEOF())
MessageBox("No records available in the database");
else
{
MessageBox(m_pSet->m_Ac_No+" "+GetStatus(m_pSet->m_Stat));
}
}
this works with precision
Success makes life easier. It doesn't make living easier.
SH UVIK
|
|
|
|
|
hi,
when creating a MDi how do i change the name of the pop up window. it comes with "new". how do i change it?
|
|
|
|
|
wrote: when creating a MDi how do i change the name of the pop up window. it comes with "new". how do i change it?
Which pop up window ? Can you reword this for clear understanding ?
wrote: Sender:
Date:6:01 29 Dec '06
Nice nic name
|
|
|
|
|
wrote: ...the pop up window.
Which one?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi All,
My program is fine when working with Debug mode. But When it is with Release mode it is giving run time error..
What it is ?
Really what is happening behind this ?
Kindly Help me...
Thanks.
|
|
|
|
|
Hi,
hm ... check if all pointers are initialized
-----------
Mila
|
|
|
|
|
Require neat code review .
Refer this[^] article for better understanding.
|
|
|
|
|
As stated by Mila025 maybe an initialization problem. uninitialized vars gets zeroes in debug mode, but gets garbage in release one. For instance if you pass a struct to a Windows API, and you not initialize it, then maybe zeroes will be harmless, while garbage will make your program crash.
hope that helps
-- modified at 6:11 Friday 29th December, 2006
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.
|
|
|
|
|
Which is the error you getting ?
If u can Dream... U can do it
|
|
|
|
|
This is something very common,
You should look:
- If your pointers are correctly initialized.
- If you are using some dll's or specific external files or programs, you should take a look if they are placed in the debug and in the release folders. (think that if somewhere of the app you are using something like GetAppPath() then you can have some problems related to files that could be in the debug folder but not in teh release one.
- Look in the project options that you have the same configuration in the DEBUG than in the RELEASE.
- There can be several other things, this can be hard to find out what is happening, but if you cannot find the problem you can always try to use MessageBoxes spreaded from the beggining to the end in order to be able to give us more information on what's happening, where and when.
Hope this helps even if it is not a very good answer.
|
|
|
|
|
Hi,
i load bitmap data by using fopen/fread standard c functions. after reading the whole image in a buffer i calculate bitmapfileheader and bitmapinfoheader from that buffer that is ok without any problem. now i want to draw this image but i am unable to draw it. i use CBitmap CreateBitmap function to create image from this data but when i draw the image it is in black color. here is code how i try to do it.
file = fopen("test.bmp", "rb");
fseek(file, SEEK_END, SEEK_END);
nSize = ftell(file);
byBmp = new BYTE[nSize];
fseek(file, SEEK_SET, SEEK_SET);
memset(byBmp, 0, nSize);
fread(byBmp,nSize, 1, file);
BITMAPFILEHEADER bmfh;
memcpy(&bmfh, byBmp, sizeof(bmfh));
BITMAPINFOHEADER bmih;
memcpy(&bmih, byBmp + sizeof(bmfh), sizeof(bmih));
BOOL b = m_bmpBackImage.CreateBitmap(bmih.biWidth, bmih.biHeight, bmih.biPlanes, bmih.biBitCount, NULL);
m_bmpBackImage.SetBitmapBits(bmih.biWidth*bmih.biHeight, byBmp + bmfh.bfOffBits);
somewhere onpaint event i try to draw this bitmap but end result is black image.
please help how can i create image from a buffer data. is there any thing that i am missing.
thanks in advance.
Omar Lodhi
|
|
|
|