Click here to Skip to main content
16,004,882 members
Home / Discussions / Article Writing
   

Article Writing

 
GeneralRe: Win 32 Api Pin
Colin Bowern29-Oct-01 17:39
Colin Bowern29-Oct-01 17:39 
GeneralRe: Win 32 Api Pin
Rassman1-Nov-01 23:46
Rassman1-Nov-01 23:46 
GeneralRe: Win 32 Api Pin
Rassman1-Nov-01 23:55
Rassman1-Nov-01 23:55 
Generalasp problem Pin
16-Oct-01 21:35
suss16-Oct-01 21:35 
Questionhow to ... Pin
ginola16-Oct-01 19:00
ginola16-Oct-01 19:00 
AnswerRe: how to ... Pin
Michael P Butler16-Oct-01 22:21
Michael P Butler16-Oct-01 22:21 
GeneralHELP ME Pin
16-Oct-01 17:16
suss16-Oct-01 17:16 
GeneralRe: HELP ME Pin
Rassman2-Nov-01 0:51
Rassman2-Nov-01 0:51 
Come on ginny, we need a bit more of a clue to answer your questions. But I like a challenge so I'll have a go at what I think you were asking.

I guess that you are writing a database application and do not know how to decide what field that data ought to go into from, say an edit box. So, from that I suspect you basically want to know how to design a database.

A database consists of,

the data - a means of receiving/writing the data - one or more views/interfaces.

Lets create a data table first. This is a list of fields and the type of data that field can hold, so we might create a table such as,

Table name = People

Field1 Name=ItemID Type=Long
Field2 Name=Name Type=Text
Field3 Name=Age Type=Integer

In row/column form this looks like

ItemID Name Age
100 Bob 43
101 Sharon 25

The means of receiving/writting to the database can be simple 'hardcoded' or SQL/ODBC. Hardcoded is obviously dependent upon the language you are using.

In VBA (Access) it can be just,

dim dbs as database
dim rst as recordset

set dbs = CurrentDB
set rst = dbs.OpenRecordSet("People",dbOpenDynaset)
with rst
{move to the record you want or .AddNew}
.Edit
!ItemID = NextAvailableID() (or use AutoNumber in Access)
!Name = "Sally"
!Age = 56
.Update
wend

Thats only to give you a starting point. Actually I think Excel/Lotus123 are very good places to learn database techniques in code.

In the 'data input' view, lets assume a simple form view, you would have an edit box for each field that the user can edit.

Edit Box 1 = Name
Edit Box 2 = Age

In this case you wouldn't want the user entering the ItemID since you want to ensure this is unique.

On pressing Enter (or selecting a button) your code updates or creates a new record in the data.

A good way to learn how databases work if your in C++ is to work with your own tables/queries/views. So that you write and experiment with each area in a place where you have full control over it.

So you might start with a simple structure such as,

class CDataNode
{
long m_ItemID;
char m_Name[30];
int m_Age;
};

Then write a class that takes care of lists of this type, avoid making use of the ready made list templates at this point since the whole purpose is to learn how to manipulate the data yourself. But of cause the likes of CMap (and its children) are extreemly usefull later.

class CDataList
{
public:
int AddNode(CDataNode* NewNode);
CDataNode GetNode(int NodeRefference);
{other functions that manipulate your data}
private:
CDataNode **m_ptrToptrOfDataNodeType;
{or for the purposes of the excercise simplify it to}
CDataNode m_MyData[SOME_MAX_NUMBER_OF_ITEMS];
};

Then you would write a view class (or rather put it into a ready made View class.

class CMyView : public CFormView
{
CDataList m_MyDataList;
//other functions that control the interface between the data and the user.
};

As you are working with this you will inevitably come across areas where your unsure if a function is part of the data or part of the view. For example in an accounts program you might have to add TAX to the user edited value. The resulting value goes into the database, but where does the calculation belong, in CDataList or in CView? I'm not going to say, it is up to you, the budding programmer, to work this out.

I obviously haven't written this in full, but you have to do some of the work yourself. Learning how to code is not programming, thats just learning a language. Programming is turning physical ideas in to programatic form, for that you need to excercise your own logic.



We do it for the joy of seeing the users struggle.
GeneralProGraMmiNg for ip phone Pin
16-Oct-01 15:52
suss16-Oct-01 15:52 
GeneralRe: ProGraMmiNg for ip phone Pin
16-Oct-01 21:33
suss16-Oct-01 21:33 
GeneralRe: ProGraMmiNg for ip phone Pin
Michael P Butler16-Oct-01 22:29
Michael P Butler16-Oct-01 22:29 
Questionhow to delete an non-empty directory Pin
SAK16-Oct-01 11:52
SAK16-Oct-01 11:52 
AnswerRe: how to delete an non-empty directory Pin
Nemanja Trifunovic16-Oct-01 11:58
Nemanja Trifunovic16-Oct-01 11:58 
AnswerRe: how to delete an non-empty directory Pin
16-Oct-01 12:07
suss16-Oct-01 12:07 
AnswerRe: how to delete an non-empty directory Pin
Michael Dunn16-Oct-01 14:57
sitebuilderMichael Dunn16-Oct-01 14:57 
AnswerRe: how to delete an non-empty directory Pin
TomKat14-Mar-03 15:55
TomKat14-Mar-03 15:55 
Questiondraw shaded rect ? Pin
16-Oct-01 9:46
suss16-Oct-01 9:46 
AnswerRe: draw shaded rect ? Pin
Rassman2-Nov-01 1:39
Rassman2-Nov-01 1:39 
Generalasp.database Pin
15-Oct-01 21:51
suss15-Oct-01 21:51 
GeneralRe: asp.database Pin
Michael P Butler15-Oct-01 22:23
Michael P Butler15-Oct-01 22:23 
GeneralDesktop Pals Creation Pin
DavidA.Robinson15-Oct-01 3:39
DavidA.Robinson15-Oct-01 3:39 
GeneralBug tracking & exception reporting like in IE6 Pin
15-Oct-01 1:01
suss15-Oct-01 1:01 
GeneralRe: Bug tracking & exception reporting like in IE6 Pin
Ravi Bhavnani15-Oct-01 1:45
professionalRavi Bhavnani15-Oct-01 1:45 
GeneralLooking for Resources on Sequent Calculus Pin
mvworld14-Oct-01 21:27
mvworld14-Oct-01 21:27 
QuestionHow can I read individual bit values in a returned integer Pin
12-Oct-01 12:12
suss12-Oct-01 12:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.