|
You really need to study basic array operations before trying to tackle something like this. There are so many things wrong with the first line alone it's difficult to know where to start...
1) Is Row1 a type you've defined? (It looks like it, since you say it's a struct...)If so, the array declaration is missing a variable name. Or...
2) Is Row1 the variable name? (It looks like it, since you're trying to initialize the array with int's, and not Row1 objects.) If so, you're missing the type, and you misuse the struct keyword...
Like I said, I'd suggest hitting the books and studying array basics. It's really difficult to offer advice on more complicated issues like ball movement if errors with the basics keep us from understanding your intent.
And thanks for using the code block tag. Not to be a nag, but you still need to look at standard indentation practices - reading your code is more difficult than it need be. (Hint - select the code in Visual Studio and simultaneously press Shift+Alt+F.)
Just trying to help, man.
|
|
|
|
|
Alright, I'll go read up on arrays some more, do you know any good sites that explains arrays using C?
I'm using Ubuntu, not Visual Studio, I've been tabbing over myself.
|
|
|
|
|
Chidori-chan wrote: do you know any good sites that explains arrays using C?
Buy any book on C; Kernighan & Ritchie wrote the definitive one some thirty years ago, which explains everything in concise detail.
|
|
|
|
|
Here, check these out -
C++ Arrays[^]
C++ Beginner's Guide[^]
The second one is an ebook that you have to download a chapter at a time. Check out chapter 4.
Don't get discouraged. You just need to get a couple basic concepts under your belt and the program will probably fall into place pretty easily.
|
|
|
|
|
Hi,
I have a small project and I need help on how to get the complete path and filename on Drag and Drop to a listbox. Afterwhich, I have to run another application to process the file and output the result on the same path and with a different filename. I'm using Visual C++ express edition 2005 (windows froms).
roughly like:
private: System::Void listbox1_DragDrop(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) {
//get filename and complete path
//execute a C++ application .exe to process file with an output
//change the output filename on the same path
//open excel (.csv) application to display the ouput file
}
and I'm planning to improve it further.
Sorry, if this question has been asked before. I'm really new in Visual C++ and want to learn by creating this small project.
The .exe that I want to run was also written by me on a console application (C++) and want to re-use it using GUI.
Thanks and Regards....
|
|
|
|
|
please, just a little help...
|
|
|
|
|
Well,
I have not used the Visual C++ 2005, but in Visual C++ 6 you can get the filename and the complete path with:
extern CMyApp theApp;
CMainFrame *pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
char FileName[MAX_PATH];
GetModuleFileName(NULL, FileName, MAX_PATH);
CString m_szName = FileName;
m_szName = m_szName.Left(m_szName.ReverseFind('\\'));
m_szName += "\\MyNewName.ext";
CFile f (m_szName, CFile::modeCreate | CFile::modeReadWrite);
Regards.
--------
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.
|
|
|
|
|
I've been working on getting a circle to fire out of a cannon and move across the screen, but the closest I've come is making it jump to the end point. I think it's because of where I'm putting the function. However, wherever else I've put it, it has frozen my program.
So what I'm wanting, is when I press my space bar, my single circle from the draw fire function below to be seen moving across the screen to the top.
Here's the snippets of my code that pertain to this function:
float fire;
glPushMatrix();
glTranslatef(250+aim,102+fire,1);
random_generator(0,3);
if (randomValue == 0)
{
glColor3f(0,.5,0);
}
else if (randomValue == 1)
{
glColor3f(.5,0,0);
}
else
{
glColor3f(0,0,.5);
}
glLineWidth(1.0);
drawFire(14,200);
glPopMatrix();
void keyboardFunction(unsigned char key, int x, int y)
{
switch (key)
{
case 'r' : d=1; break;
case 's' : d=2; break;
case ' ' :
for (fire=0; fire<353; fire++)
{
};
break;
}
glutPostRedisplay();
}
Do you all have any idea what I could do to make it move across the screen instead of jumping?
|
|
|
|
|
Your code is not very clear but it seems you are trying to move your circle inside a for loop (even if this loop is empty). That's not going to work: you need to render the full scene each time something change or at a specific time rate (which is usually used for games). As you have one single thread (and you shouldn't have more in this situation), your for loop will prevent any redrawing on the screen (thus, you see a jump). You need to keep a flag that specifies if the circle is moving or not and if this flag is set, you ahve to update the circle position at each frame depending on the elapsed time.
If your program is written in C++ (and not pure C), I suggest you take a look at my signature for the OpenGL tutorial. All these things are explained but you need to have a good background in C++.
|
|
|
|
|
Thanks, but do you know of any tutorials that are pure C? That's what I'm writing my code in.
|
|
|
|
|
void RFX_Text_Bulk(
CFieldExchange* pFX,
LPCTSTR szName,
LPSTR* prgStrVals,
long** prgLengths,// show how to setup and implement
int nMaxLength
);
I need for someone to show me how to setup and implement this field " long** prgLengths"
all examples I've seen shows long* prgLengths in the header and prgLengths = NULL; in the constructor.
I tried that in my program and it came up with an error(compiler) that last two varables not implemented, meaning
long** prgLengths and int nMaxLength .
I have a CString that can at times greatly exceed the max of 255 char. That's why I need to implement the RFX_Text_Bulk function, but I can't find an example to show me how to do so.
Can anyone show me how with a working example. Please note that most times this varable will not be longer that 255 char, then there are times that it will!
A C++ programming language novice, but striving to learn
|
|
|
|
|
My best guess without reading the documentation:
CFieldExchange fieldX;
LPCTSTR szName[256];
LPSTR prgStrVals;
long* prgLengths;
int nMaxLength = 255;
RFX_Text_Bulk(&fieldX, szName, &prgStrVals, &prgLengths, nMaxLength);
Just provide the address of the variable that is a pointer to a long.
|
|
|
|
|
Sorry, that doesn't work. I thought the same thing. they want something for "prgLengths" but I don't know what. I've tried many examples shown through out the internet, but the errors remain.
A C++ programming language novice, but striving to learn
|
|
|
|
|
I took a look at the MSDN page[^] and think it should be something like this
CFieldExchange fieldX;
LPCTSTR pszName = "ColName";
LPSTR prgStrVals[nRows];
long prgLengths[nRows];
for (int i = 0; i < nRows; ++i)
{
prgStrVals[i] = (LPSTR)new char[256];
}
int nMaxLength = 256;
RFX_Text_Bulk(&fieldX, pszName, &prgStrVals, &prgLengths, nMaxLength);
The prgStrVals and prgLengths fields are arrays that will be filled by the function, so you need to pre-allocate enough for the number of rows you are transferring. Each entry in prgStrVals is a pointer to a buffer that will hold the data for the appropriate row, so each of these buffers must be long enough to hold the longest data item. The maximum length of the items to be stored is indicated by the nMaxLength field.
[edit]Added the link to the MSDN entry[/edit]
|
|
|
|
|
Please excuse my ignorance: This particular record only has one column data that requires at least 1024 chars so how do I set that colum up to receive and return 1024 chars (if that is the amount inputed? the column's varable is "m_Instructions", which is the "Preparation Instructions for a recipe.
please use this data in your explaination:
Note there are 58 varables in this record.
pszName = "Instructions";//Column header
prgStrVals = "m_Instructions"// varable
prgLengths = ???//don't know
nMaxLength = 1024;
RFX_Text_Bulk(fieldX, pszName, &prgStrVals, &prgLengths, nMaxLength);
A C++ programming language novice, but striving to learn
modified on Sunday, December 13, 2009 10:41 AM
|
|
|
|
|
Larry Mills Sr wrote: Please excuse my ignorance
No excuse needed, you are merely trying to learn.
I think the following should do it:
CFieldExchange fieldX;
LPCTSTR pszName = "Recipe";
int nRows = ?;
int nMaxLength = 1024;
LPSTR prgStrVals[nRows];
long prgLengths[nRows];
for (int i = 0; i < nRows; ++i)
{
prgStrVals[i] = (LPSTR)new char[nMaxLength];
}
RFX_Text_Bulk(&fieldX, pszName, &prgStrVals, &prgLengths, nMaxLength);
pszName is the name of the column in the data source; I'm not sure which that should be, but you will. The array prgStrVals needs to be lare enough to accept all the rows of data from the source (I guess there is some way of finding this value) and each entry is a pointer to a buffer of at least 1024 characters, as set in the for loop. On return if successful each entry in prgStrVals should contain the text from the corresponding row, and each entry in prgLengths should contain the length of that data.
|
|
|
|
|
Perhaps it would help if I enclosed my Recordset:
Recordset header(part):
LONG_PTR prgLengths;
int nMaxLength;
int nRows; // set this to the number of rows in the data
long m_ID;
CString m_Category;
CString m_RecipeName;
CString m_RecipeType;
CString m_FullFilePath;
CString m_Ingred1;
CString m_Amt1;
CString m_Unit1;
CString m_Ingred2;
CString m_Amt2;
CString m_Unit2;
CString m_Ingred3;
CString m_Amt3;
CString m_Unit3;
CString m_Ingred4;
CString m_Amt4;
CString m_Unit4;
CString m_Ingred5;
CString m_Amt5;
CString m_Unit5;
CString m_Ingred6;
CString m_Amt6;
CString m_Unit6;
CString m_Ingred7;
CString m_Amt7;
CString m_Unit7;
CString m_Ingred8;
CString m_Amt8;
CString m_Unit8;
CString m_Ingred9;
CString m_Amt9;
CString m_Unit9;
CString m_Ingred10;
CString m_Amt10;
CString m_Unit10;
CString m_Ingred11;
CString m_Amt11;
CString m_Unit11;
CString m_Ingred12;
CString m_Amt12;
CString m_Unit12;
CString m_Ingred13;
CString m_Amt13;
CString m_Unit13;
CString m_Ingred14;
CString m_Amt14;
CString m_Unit14;
CString m_Ingred15;
CString m_Amt15;
CString m_Unit15;
CString m_Instructions;
CString m_CookMethod;
CString m_Servings;
CString m_BitMapPath;
CString m_Extra1;
CString m_Extra2;
CString m_Extra3;
CString m_Extra4;
Initialized:
nRows = 0;
prgLengths = 1024;
nMaxLength = 1024;
m_ID = 0;
m_Category = "";
m_RecipeName = "";
m_RecipeType = "";
m_FullFilePath = "";
m_Ingred1 = "";
m_Amt1 = "";
m_Unit1 = "";
m_Ingred2 = "";
m_Amt2 = "";
m_Unit2 = "";
m_Ingred3 = "";
m_Amt3 = "";
m_Unit3 = "";
m_Ingred4 = "";
m_Amt4 = "";
m_Unit4 = "";
m_Ingred5 = "";
m_Amt5 = "";
m_Unit5 = "";
m_Ingred6 = "";
m_Amt6 = "";
m_Unit6 = "";
m_Ingred7 = "";
m_Amt7 = "";
m_Unit7 = "";
m_Ingred8 = "";
m_Amt8 = "";
m_Unit8 = "";
m_Ingred9 = "";
m_Amt9 = "";
m_Unit9 = "";
m_Ingred10 = "";
m_Amt10 = "";
m_Unit10 = "";
m_Ingred11 = "";
m_Amt11 = "";
m_Unit11 = "";
m_Ingred12 = "";
m_Amt12 = "";
m_Unit12 = "";
m_Ingred13 = "";
m_Amt13 = "";
m_Unit13 = "";
m_Ingred14 = "";
m_Amt14 = "";
m_Unit14 = "";
m_Ingred15 = "";
m_Amt15 = "";
m_Unit15 = "";
m_Instructions = "";
m_CookMethod = "";
m_Servings = "";
m_BitMapPath = "";
m_Extra1 = "";
m_Extra2 = "";
m_Extra3 = "";
m_Extra4 = "";
m_nFields = 58;
//m_nDefaultType = dynaset;
m_nDefaultType = snapshot;
void CMyDB::DoFieldExchange(CFieldExchange* pFX)
{
pFX->SetFieldType(CFieldExchange::outputColumn);
// Macros such as RFX_Text() and RFX_Int() are dependent on the
// type of the member variable, not the type of the field in the database.
// ODBC will try to automatically convert the column value to the requested type
RFX_Long(pFX, _T("[ID]"), m_ID);
RFX_Text(pFX, _T("[Category]"), m_Category);
RFX_Text(pFX, _T("[RecipeName]"), m_RecipeName);
RFX_Text(pFX, _T("[RecipeType]"), m_RecipeType);
RFX_Text(pFX, _T("[FullFilePath]"), m_FullFilePath);
RFX_Text(pFX, _T("[Ingred1]"), m_Ingred1);
RFX_Text(pFX, _T("[Amt1]"), m_Amt1);
RFX_Text(pFX, _T("[Unit1]"), m_Unit1);
RFX_Text(pFX, _T("[Ingred2]"), m_Ingred2);
RFX_Text(pFX, _T("[Amt2]"), m_Amt2);
RFX_Text(pFX, _T("[Unit2]"), m_Unit2);
RFX_Text(pFX, _T("[Ingred3]"), m_Ingred3);
RFX_Text(pFX, _T("[Amt3]"), m_Amt3);
RFX_Text(pFX, _T("[Unit3]"), m_Unit3);
RFX_Text(pFX, _T("[Ingred4]"), m_Ingred4);
RFX_Text(pFX, _T("[Amt4]"), m_Amt4);
RFX_Text(pFX, _T("[Unit4]"), m_Unit4);
RFX_Text(pFX, _T("[Ingred5]"), m_Ingred5);
RFX_Text(pFX, _T("[Amt5]"), m_Amt5);
RFX_Text(pFX, _T("[Unit5]"), m_Unit5);
RFX_Text(pFX, _T("[Ingred6]"), m_Ingred6);
RFX_Text(pFX, _T("[Amt6]"), m_Amt6);
RFX_Text(pFX, _T("[Unit6]"), m_Unit6);
RFX_Text(pFX, _T("[Ingred7]"), m_Ingred7);
RFX_Text(pFX, _T("[Amt7]"), m_Amt7);
RFX_Text(pFX, _T("[Unit7]"), m_Unit7);
RFX_Text(pFX, _T("[Ingred8]"), m_Ingred8);
RFX_Text(pFX, _T("[Amt8]"), m_Amt8);
RFX_Text(pFX, _T("[Unit8]"), m_Unit8);
RFX_Text(pFX, _T("[Ingred9]"), m_Ingred9);
RFX_Text(pFX, _T("[Amt9]"), m_Amt9);
RFX_Text(pFX, _T("[Unit9]"), m_Unit9);
RFX_Text(pFX, _T("[Ingred10]"), m_Ingred10);
RFX_Text(pFX, _T("[Amt10]"), m_Amt10);
RFX_Text(pFX, _T("[Unit10]"), m_Unit10);
RFX_Text(pFX, _T("[Ingred11]"), m_Ingred11);
RFX_Text(pFX, _T("[Amt11]"), m_Amt11);
RFX_Text(pFX, _T("[Unit11]"), m_Unit11);
RFX_Text(pFX, _T("[Ingred12]"), m_Ingred12);
RFX_Text(pFX, _T("[Amt12]"), m_Amt12);
RFX_Text(pFX, _T("[Unit12]"), m_Unit12);
RFX_Text(pFX, _T("[Ingred13]"), m_Ingred13);
RFX_Text(pFX, _T("[Amt13]"), m_Amt13);
RFX_Text(pFX, _T("[Unit13]"), m_Unit13);
RFX_Text(pFX, _T("[Ingred14]"), m_Ingred14);
RFX_Text(pFX, _T("[Amt14]"), m_Amt14);
RFX_Text(pFX, _T("[Unit14]"), m_Unit14);
RFX_Text(pFX, _T("[Ingred15]"), m_Ingred15);
RFX_Text(pFX, _T("[Amt15]"), m_Amt15);
RFX_Text(pFX, _T("[Unit15]"), m_Unit15);
RFX_Text_Bulk(pFX, _T("[Instructions]"), (LPSTR *)&m_Instructions,(long**)prgLengths,nMaxLength);//doesn't work
RFX_Text(pFX, _T("[CookMethod]"), m_CookMethod);
RFX_Text(pFX, _T("[Servings]"), m_Servings);
RFX_Text(pFX, _T("[BitMapPath]"), m_BitMapPath);
RFX_Text(pFX, _T("[Extra1]"), m_Extra1);
RFX_Text(pFX, _T("[Extra2]"), m_Extra2);
RFX_Text(pFX, _T("[Extra3]"), m_Extra3);
RFX_Text(pFX, _T("[Extra4]"), m_Extra4);
}
I do not understand this:
for (int i = 0; i < nRows; ++i)
{
prgStrVals[i] = (LPSTR)new char[nMaxLength];
}
There is only ONE Column's data that will be greater (at times) than 255 chars. That column is "Instructions"
how do I set that up? Please excuse my ignorance(again)
A C++ programming language novice, but striving to learn
|
|
|
|
|
Larry Mills Sr wrote: RFX_Text_Bulk(pFX, _T("[Instructions]"), (LPSTR *)&m_Instructions,(long**)prgLengths,nMaxLength);//doesn't work
I think you are trying to make something that which it is not, by the use of casts; if you'll pardon my circumlocution.
The third field of the RFX_Text_Bulk() call must be "A pointer to an array of LPSTR values", as defined in my previous post. The for loop initialises each entry to a buffer that can hold up to the maximum length of data for the column in question. However you are trying to cast the address of a CString to an array of pointers, which will not work.
However, having looked again at what you are doing I am getting the feeling that the RFX_Text_Bulk() call is not what you need, you should be using the RFX_Text() call, the same as all the other fields, but with a nMaxLength value thus:
RFX_Text(pFX, _T("[Instructions]"), m_Instructions, 1024);
I guess you may have been confused by the definition on the MSDN page[^]. Where it says int nMaxLength = 255, in the function definition, which just means that if you do not specifiy a value for this field the compiler will automatically use 255. You are still at liberty to use a smaller or larger value in the range [1 to INT_MAX].
|
|
|
|
|
I tried that, and while it gave me no errors; it also DID NOT put all the data from m_Instructions into the database (It has the data in the varable before calling Update();)
A C++ programming language novice, but striving to learn
|
|
|
|
|
Larry Mills Sr wrote: I tried that, and while it gave me no errors; it also DID NOT put all the data from m_Instructions into the database (It has the data in the varable before calling Update();)
Well I'm afraid I'm a bit lost now as I thought you were trying to read data out of the database. I cannot see anything wrong with the last set of calls unless you are doing it in the wrong direction somehow.
|
|
|
|
|
Larry Mills Sr wrote: it also DID NOT put all the data from m_Instructions into the database (It has the data in the varable before calling Update();)
Well having slept on this I guess we are now into a new problem. May I suggest you post as a new question showing how you are trying the database update and how your program variables map to the database fields. I know there are a lot of very smart DB experts on this site so I'm sure one of them will pick it up quite quickly.
|
|
|
|
|
Because of the prior code listing I'll post all the code here.
How I write to the DB
void CCookItDBDoc::OnRecordNew(CRecipeData cData, int nIndex)
{
m_cRecipeData.CleanUp();
m_cRecipeData = cData;
//CheckStrSize();
//m_CookItDBSet.CleanUp();
TRY
{
if (m_CookItDBSet.Open(CRecordset::dynaset, NULL, CRecordset::appendOnly))
{
m_CookItDBSet.AddNew();
if(nIndex == 0)
{
m_CookItDBSet.m_ID = 1;
}
//nRecord = m_CookItDBSet.m_ID;
//m_CookItDBSet.CleanUp();
m_CookItDBSet.m_Category = m_cRecipeData.m_csCategory;
m_CookItDBSet.m_RecipeName = m_cRecipeData.m_csRecipeName;
m_CookItDBSet.m_RecipeType = m_cRecipeData.m_csRecipeType;
m_CookItDBSet.m_FullFilePath = m_cRecipeData.m_csFullFilePath;
m_CookItDBSet.m_Ingred1 = m_cRecipeData.m_csIngred1;
m_CookItDBSet.m_Amt1 = m_cRecipeData.m_csAmt1;
m_CookItDBSet.m_Unit1 = m_cRecipeData.m_csUnit1;
m_CookItDBSet.m_Ingred2 = m_cRecipeData.m_csIngred2;
m_CookItDBSet.m_Amt2 = m_cRecipeData.m_csAmt2;
m_CookItDBSet.m_Unit2 = m_cRecipeData.m_csUnit2;
m_CookItDBSet.m_Ingred3 = m_cRecipeData.m_csIngred3;
m_CookItDBSet.m_Amt3 = m_cRecipeData.m_csAmt3;
m_CookItDBSet.m_Unit3 = m_cRecipeData.m_csUnit3;
m_CookItDBSet.m_Ingred4 = m_cRecipeData.m_csIngred4;
m_CookItDBSet.m_Amt4 = m_cRecipeData.m_csAmt4;
m_CookItDBSet.m_Unit4 = m_cRecipeData.m_csUnit4;
m_CookItDBSet.m_Ingred5 = m_cRecipeData.m_csIngred5;
m_CookItDBSet.m_Amt5 = m_cRecipeData.m_csAmt5;
m_CookItDBSet.m_Unit5 = m_cRecipeData.m_csUnit5;
m_CookItDBSet.m_Ingred6 = m_cRecipeData.m_csIngred6;
m_CookItDBSet.m_Amt6 = m_cRecipeData.m_csAmt6;
m_CookItDBSet.m_Unit6 = m_cRecipeData.m_csUnit6;
m_CookItDBSet.m_Ingred7 = m_cRecipeData.m_csIngred7;//23
m_CookItDBSet.m_Amt7 = m_cRecipeData.m_csAmt7;
m_CookItDBSet.m_Unit7 = m_cRecipeData.m_csUnit7;
m_CookItDBSet.m_Ingred8 = m_cRecipeData.m_csIngred8;
m_CookItDBSet.m_Amt8 = m_cRecipeData.m_csAmt8;
m_CookItDBSet.m_Unit8 = m_cRecipeData.m_csUnit8;//28
m_CookItDBSet.m_Ingred9 = m_cRecipeData.m_csIngred9;
m_CookItDBSet.m_Amt9 = m_cRecipeData.m_csAmt9;
m_CookItDBSet.m_Unit9 = m_cRecipeData.m_csUnit9;
m_CookItDBSet.m_Ingred10 = m_cRecipeData.m_csIngred10;
m_CookItDBSet.m_Amt10 = m_cRecipeData.m_csAmt10;
m_CookItDBSet.m_Unit10 = m_cRecipeData.m_csUnit10;
m_CookItDBSet.m_Ingred11 = m_cRecipeData.m_csIngred11;
m_CookItDBSet.m_Amt11 = m_cRecipeData.m_csAmt11;
m_CookItDBSet.m_Unit11 = m_cRecipeData.m_csUnit11;
m_CookItDBSet.m_Ingred12 = m_cRecipeData.m_csIngred12;
m_CookItDBSet.m_Amt12 = m_cRecipeData.m_csAmt12;
m_CookItDBSet.m_Unit12 = m_cRecipeData.m_csUnit12;
m_CookItDBSet.m_Ingred13 = m_cRecipeData.m_csIngred13;
m_CookItDBSet.m_Amt13 = m_cRecipeData.m_csAmt13;
m_CookItDBSet.m_Unit13 = m_cRecipeData.m_csUnit13;
m_CookItDBSet.m_Ingred14 = m_cRecipeData.m_csIngred14;
m_CookItDBSet.m_Amt14 = m_cRecipeData.m_csAmt14;
m_CookItDBSet.m_Unit14 = m_cRecipeData.m_csUnit14;
m_CookItDBSet.m_Ingred15 = m_cRecipeData.m_csIngred15;
m_CookItDBSet.m_Amt15 = m_cRecipeData.m_csAmt15;
m_CookItDBSet.m_Unit15 = m_cRecipeData.m_csUnit15;
m_CookItDBSet.m_Instructions = m_cRecipeData.m_csInstructions;//not saving 1024 char
m_CookItDBSet.m_CookMethod = m_cRecipeData.m_csCookMethod;
m_CookItDBSet.m_Servings = m_cRecipeData.m_csServings;
m_CookItDBSet.m_BitMapPath = m_cRecipeData.m_csBitMapPath;
m_CookItDBSet.m_Extra1 = m_cRecipeData.m_csExtra1;
m_CookItDBSet.m_Extra2 = m_cRecipeData.m_csExtra2;//55
m_CookItDBSet.m_Extra3 = m_cRecipeData.m_csExtra3;
m_CookItDBSet.m_Extra4 = m_cRecipeData.m_csExtra4;
SetID(m_CookItDBSet.m_ID);
m_CookItDBSet.Update();
m_CookItDBSet.Close();
//UpdateAllViews(NULL);
}//if
}//TRY
CATCH(CDBException, pDBException)
{
AfxMessageBox(pDBException->m_strError);
}//CATCH
END_CATCH
}
The m_CookItDBSet.m_Instructions varable has all the data in it before the m_CookItDBSet.Update(); function is called, but checking the database in MS Access most of the data for Instructions is gone.
A C++ programming language novice, but striving to learn
|
|
|
|
|
I'm afraid I have nothing to suggest now as this appears to be a database issue, and my DB skills are minimal at best. As I suggested earier I think you should start a new thread in the Database forum and see if one of the experts can help.
|
|
|
|
|
I create a SDI application,which deals with ODBC. When I debug the application, so weired thing happens.
In MainFrm.cpp,the application run into CMainFrame::OnCreate function. When it comes to CFrameWnd::OnCreate function, the application is paused.Detailed information is below.
Prompt information on popup dialog shows a breakpoint is trigged. The output window says Invalid Address specified to RtlValidateHeap( 00E30000, 00E36918 ). The application finally stops at the following positon.
~CSimpleStringT() throw()
{
CStringData* pData = GetData();
pData->Release();
} (<atlsimpstr.h>)
Before CFrameWnd::OnCreate function,code is generated by mfc classwizard.I don't do anything, including memory operation. So I don't know why this happens.
Due these code executed comes from mfc classwizard, I create a new SID project without ODBC. Configures excepte database function are the same as the former one. This application works properly. After debugging these two application by step for CFrameWnd::OnCreate function, I find one difference. When it comes to the statement
if (!pView->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
CRect(0,0,0,0), this, nID, pContext)) (<winfrm.cpp>)
the former application goes into CFormView::Create, while the latter one goes into CWnd::Create. I don't know whether the problem is here.
Hope someone could give me some clues or solution,thanks in advance.
If my description is unclear or undetailed, please let me know. Thanks a lot.
|
|
|
|
|
You should use your debugger and see where the code crashes exactly (using the call stack, you can track it to your code). Inspect the different at that time and see if something is not as it should be. If you are still stuck, post the code snippet which is causing troubles.
|
|
|
|
|