Database for programHow would I?
17 Replies - 717 Views - Last Post: 22 January 2010 - 09:27 AM
#1
Database for program
Posted 20 January 2010 - 03:05 PM
I am about to start my interface but thought I would ask this question so that I can be readyw hen I get to that point. The application won't be anything fancy, maybe 2 or 3 forms.
The main will list each job and allow me to View Details which would show a log of when I called, comments, name of job, city, etc. If it was in an XML it wouldn't be too hard. But say I apply for one job but in two cities I am not sure if I could have two entries for it, but am thinking it might be best.
Any other suggestions?
Replies To: Database for program
#2
Re: Database for program
Posted 20 January 2010 - 03:43 PM
#3
Re: Database for program
Posted 20 January 2010 - 03:48 PM
Once that's done, I suggest you start up a google search for "C# SQL". This should get you plenty of information to work with.
In regards to your project, it seems kind of small enough to not really warrant an OR/M library, but if you feel compelled to spread your wings in that direction, start researching about NHibernate and LINQ. Pick the one you are more comfortable with.
If you decided not to go with a framework, start researching T-SQL syntax and learning it. I suggest you create a couple tables in a database on your newly downloaded SQL Express installation and playing around with it.
Once you have a pretty good feel for what you're doing, start implementing code that does what you can now do manually. This code should cover the CRUD operations of database access which are create, read, update, delete. At this point, you're going to want to think about how these things affect the state of your database and really pin-pointing the queries you're going to need (assuming you didn't go the OR/M route).
When you run into trouble, you know where we are.
Good luck with your project.
EDIT:
I noticed FlashM mention using Access. I personally do not believe there is ANY project that is worth delving into access really - at least when SQL Express became free and available. It's your choice though. Remember to just weigh out your options in context to your efforts.
This post has been edited by MentalFloss: 20 January 2010 - 03:50 PM
#4
Re: Database for program
Posted 20 January 2010 - 03:58 PM
LINQ is really cool, but as far as I know it works only with Microsoft SQL database. Or am I wrong?
NHiberanete is the really really really COOL and possibly the best tool you could choose, but there's a really BIIIG BUT... It could be really painful to configure it to work. We use NHibernate at work, combining it with ActiveWriter to autogenerate model and all the hbm files and stuff. But this tool is really not simple to use.
#5
Re: Database for program
Posted 20 January 2010 - 04:18 PM
Quote
It'd just be LINQ to ODBC.
Alternately, you could create your own custom provider.
#6
Re: Database for program
Posted 20 January 2010 - 04:19 PM
#7
Re: Database for program
Posted 20 January 2010 - 05:52 PM
Sometimes using a database is overkill.
#8
Re: Database for program
Posted 20 January 2010 - 05:58 PM
papuccino1, on 20 Jan, 2010 - 04:52 PM, said:
Sometimes using a database is overkill.
That is what I was thinking about it would be more difficult to create a log of times for the XML. Granted I could store most recent and one previous. Seems to be the most logical anyways.
My file could be something like this:
<joblog> <job id="" name="" city="" applied="" contact="" prevcall="" lastcall="" comment="" /> </joblog>
What might I be missing? I think I have all the important info. Should I limit my attributes per element? Right there is 8 of them which seems to be quite a bit. Then again I won't be in the file itself but have a form populated by info from it.
#9
Re: Database for program
Posted 20 January 2010 - 06:11 PM
Quote
Try it and see.
If it starts getting too hard to work with, then you can think of a different way to do it. This seems fine for now though.
#10
Re: Database for program
Posted 20 January 2010 - 06:14 PM
<Jobs>
<Job ID="" Company="" Position="">
<Details Contact="" Comment="">
<Calls>
<Call ID="" Date="" Comment=""/>
<Call ID="" Date="" Comment=""/>
<Call ID="" Date="" Comment=""/>
</Calls>
</Details>
</Job>
</Jobs>
For multiple calls you can easily create new <Call> elements with ID properties set to each.
But this is just personal preference, there's really no "right" answer, just what format will give you an easier time generating the form.
This post has been edited by papuccino1: 20 January 2010 - 06:15 PM
#11
Re: Database for program
Posted 20 January 2010 - 06:18 PM
papuccino1, on 20 Jan, 2010 - 05:14 PM, said:
<Jobs>
<Job ID="" Company="" Position="">
<Details Contact="" Comment="">
<Calls>
<Call ID="" Date="" Comment=""/>
<Call ID="" Date="" Comment=""/>
<Call ID="" Date="" Comment=""/>
</Calls>
</Details>
</Job>
</Jobs>
For multiple calls you can easily create new <Call> elements with ID properties set to each.
But this is just personal preference, there's really no "right" answer, just what format will give you an easier time generating the form.
That looks like it might work. I do not need a call ID though, might be useful, I will have to see how easy I can add that element.
#12
Re: Database for program
Posted 20 January 2010 - 06:19 PM
Quote
<Jobs> <Job ID="" Company="" Position=""> <Details Contact="" Comment=""> <Calls> <Call ID="" Date="" Comment=""/> <Call ID="" Date="" Comment=""/> <Call ID="" Date="" Comment=""/> </Calls> </Details> </Job> </Jobs>
Yeah, I dig this approach. However, as stated, the original idea should work fine too - and it will take less file space comparatively when all's said and done.
This post has been edited by MentalFloss: 20 January 2010 - 06:19 PM
#13
Re: Database for program
Posted 20 January 2010 - 06:21 PM
MentalFloss, on 20 Jan, 2010 - 05:19 PM, said:
Quote
<Jobs> <Job ID="" Company="" Position=""> <Details Contact="" Comment=""> <Calls> <Call ID="" Date="" Comment=""/> <Call ID="" Date="" Comment=""/> <Call ID="" Date="" Comment=""/> </Calls> </Details> </Job> </Jobs>
Yeah, I dig this approach. However, as stated, the original idea should work fine too - and it will take less file space comparatively when all's said and done.
Filesize isnt a huge issue for me, but its good to know. This approach gives more flexibility though. What is the best way to get the final ID of the job so if I close the program but add another later it goes in the right spot?
This post has been edited by blank_program: 20 January 2010 - 06:23 PM
#14
Re: Database for program
Posted 20 January 2010 - 06:32 PM
XmlTextWriter textWriter = new XmlTextWriter("C:\\myFile.xml", null) ;
Read more in depth information here:
http://www.c-sharpco...utmellli21.aspx
#15
Re: Database for program
Posted 20 January 2010 - 06:35 PM
papuccino1, on 20 Jan, 2010 - 05:32 PM, said:
XmlTextWriter textWriter = new XmlTextWriter("C:\\myFile.xml", null) ;
Read more in depth information here:
http://www.c-sharpco...utmellli21.aspx
I know how to write to XML but I would need the last ID number each time. I guess I could evaluate how many job elements there are when the program loads and keep an integer for that.
|
|

New Topic/Question
Reply




MultiQuote




|