Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Title: out of memory

Status
Not open for further replies.

HadiRezaee

Technical User
Mar 9, 2001
165
IR
I'm writing program about database.
In my database i have 3 tables:

CDINFO, PERSON, GETGIVE

And i have 3 fields in CDINFO table:

FILMNAME ---> Text
FILMCODE ---> Integer
COUNT ---> Integer

I'm using of three objects of CDaoRecordset for opening each table ...
Now, i want to add new record in CDINFO:

COleVariant var;
char *szFilm = new char[50];
var.vt = VT_INT;


GetDlgItemText(IDC_EDIT1, szFilm, 50);
var.intVal = GetDlgItemInt(IDC_EDIT2);


m_rsCDINFO->AddNew();
m_rsCDINFO->SetFieldValue("FILMCODE", var);
m_rsCDINFO->SetFieldValue("FILMNAME", szFilm);
m_rsCDINFO->SetFieldValue("COUNT", var);
m_rsCDINFO->Update();

SetDlgItemText(IDC_EDIT1, "");
SetDlgItemText(IDC_EDIT2, "");

delete[] szFilm;

This code have not any error or warning, but when i'll running this code, program indicate to me error about: "Out of memory" !!!
Please tell me, what is my wrong ?
 
i think you may need a m_rsCDINFO->Close() unless that is handled elsewhere. Check to see where you new this or set it and if it is getting new'ed without closing and deleting I think the problem may lie here.

Matt
 
Check the length of IDC_EDIT1 which may be more that what you are allocating for i.e. 50.

By the way why COleVariant ?


Vaquar
 
Out of memory could be also because of recursions. Try to see if are there some indirect recursuons which are not always easy to find. John Fill
1c.bmp


ivfmd@mail.md
 
Hi again,
If posible, please check my source code about writing integer value in integer fields(COUNT & FILMCODE) ...
Is that true ???
Does i have any other way for adding integer value to integer fields ???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top