This is probably the wrong place to ask....

  • Thread starter Thread starter Scott Manson
  • Start date Start date
S

Scott Manson

I am working on a database access program using C# and am having a few
problems.

I am collecting data that may or may not be in order and may or may
not be in the database. I have 2 classes that take care of the parsing
of the data and everything is working fine I can query my DB and such
but I am having trouble with adding an entry if the entry is not in
the DB.

I currently am having problems with not getting the correct data at
the right time..... i.e. I could get an answer w/o a corresponding
question and I need both a question/answer pair in order to insert the
new pair into the DB.

I am a beginning programmer (i.e. never been "paid" for my programming
work) and am willing to listen to the experts on what I could/should
be doing.
 
Off the top of my head, a question table and and answer table and a
linking table called "question_answer".

Questions
QuestionID PK --< Question_Answers
QuestionID FK
AnswerID FK >------ Answers

AnswerID PK

Regards,
Jeff
I could get an answer w/o a corresponding
question and I need both a question/answer pair in order to insert the
new pair into the DB.<
 
This type of question is more related to db schema design and general
application design than to c# language and .net. You might try one of
microsoft.public.sqlserver groups. However before that would be better to
think about the problem in business terms.

Short answer: you have to think if and how you want to save incorrect
information in your db and how much of it - if it is worth anything at all.
Generally speaking, what is the worthiness of the answer w/o question? If it
has any for you - you need to store it in some additional table and find a
way to get back to source to obtain missing data. After some time period -
on hour or 1 century -original answer w/o question will become garbage,
which should be removed from db. If you can get to original question, then
you can do proper update of db and remove incomplete entry. Same reasoning
applies to questions w/o answers.

Additional note: it's general problem of any application - how to deal with
incorrect or partially correct data (input). So, all pros are having same
problems like you. However, in this case try to find out if there is any
business (common) sense in what you are trying to do.

If you have specific problem with accessing database and data insertion -
check this link
http://msdn.microsoft.com/vcsharp/downloads/samples/23samples/default.aspx
There is complete sample how to read/write data from SQL database

If you have problem with general application design issues - I'm out of
links, sorry!

Long answer: data are incomplete for answer.

HTH
Alex
 
Back
Top