Database for program

How would I?

  • (2 Pages)
  • +
  • 1
  • 2

17 Replies - 941 Views - Last Post: 22 January 2010 - 09:27 AM Rate Topic: -----

#1 blank_program  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 11
  • View blog
  • Posts: 284
  • Joined: 22-July 09

Database for program

Post icon  Posted 20 January 2010 - 03:05 PM

I am thinking of making a personal application to keep track of when I apply for jobs or call back. Now I want some buttons that I can just click to insert the time and/or date, but if I want to keep a log of them is the issue. I want to keep learning how to work with XML but that could be a hassle. I don't know where to start with a SQL database or Access DB so any suggestions would be welcome.

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?

Is This A Good Question/Topic? 0
  • +

Replies To: Database for program

#2 FlashM  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 382
  • View blog
  • Posts: 1,195
  • Joined: 03-December 09

Re: Database for program

Posted 20 January 2010 - 03:43 PM

For this kind of application, where you know there won't be like thousands of records, I'd go for Access database which more that fulfills your demands.
Was This Post Helpful? 0
  • +
  • -

#3 MentalFloss  Icon User is offline

  • "ADDICTED"[2:5]
  • member icon

Reputation: 528
  • View blog
  • Posts: 1,397
  • Joined: 02-September 09

Re: Database for program

Posted 20 January 2010 - 03:48 PM

If you're going to pursue the SQL route, I suggest you download Microsoft SQL Express.

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

Was This Post Helpful? 0
  • +
  • -

#4 FlashM  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 382
  • View blog
  • Posts: 1,195
  • Joined: 03-December 09

Re: Database for program

Posted 20 January 2010 - 03:58 PM

A totally agree with MentalFloss, but I mentioned Access since it's the easiest database tool to use and you don't need any knowledge to configure the database server as you have to when installing MS SQL Express.

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.
Was This Post Helpful? 0
  • +
  • -

#5 MentalFloss  Icon User is offline

  • "ADDICTED"[2:5]
  • member icon

Reputation: 528
  • View blog
  • Posts: 1,397
  • Joined: 02-September 09

Re: Database for program

Posted 20 January 2010 - 04:18 PM

Quote

LINQ is really cool, but as far as I know it works only with Microsoft SQL database. Or am I wrong?


It'd just be LINQ to ODBC.
Alternately, you could create your own custom provider.
Was This Post Helpful? 0
  • +
  • -

#6 FlashM  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 382
  • View blog
  • Posts: 1,195
  • Joined: 03-December 09

Re: Database for program

Posted 20 January 2010 - 04:19 PM

That sounds cool! Guess I'll have to dig up into LINQ sometime soon :-)
Was This Post Helpful? 0
  • +
  • -

#7 papuccino1  Icon User is offline

  • His name was Robert Paulson.
  • member icon

Reputation: 63
  • View blog
  • Posts: 1,121
  • Joined: 02-March 08

Re: Database for program

Posted 20 January 2010 - 05:52 PM

I'd consider going for the XML approach. If you're going to have small amount of records and want the application to be portable, you could just save all your records to a .XML file.

Sometimes using a database is overkill.
Was This Post Helpful? 0
  • +
  • -

#8 blank_program  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 11
  • View blog
  • Posts: 284
  • Joined: 22-July 09

Re: Database for program

Posted 20 January 2010 - 05:58 PM

View Postpapuccino1, on 20 Jan, 2010 - 04:52 PM, said:

I'd consider going for the XML approach. If you're going to have small amount of records and want the application to be portable, you could just save all your records to a .XML file.

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.
Was This Post Helpful? 0
  • +
  • -

#9 MentalFloss  Icon User is offline

  • "ADDICTED"[2:5]
  • member icon

Reputation: 528
  • View blog
  • Posts: 1,397
  • Joined: 02-September 09

Re: Database for program

Posted 20 January 2010 - 06:11 PM

Quote

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.


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.
Was This Post Helpful? 0
  • +
  • -

#10 papuccino1  Icon User is offline

  • His name was Robert Paulson.
  • member icon

Reputation: 63
  • View blog
  • Posts: 1,121
  • Joined: 02-March 08

Re: Database for program

Posted 20 January 2010 - 06:14 PM

I'd do something like:
<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

Was This Post Helpful? 1
  • +
  • -

#11 blank_program  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 11
  • View blog
  • Posts: 284
  • Joined: 22-July 09

Re: Database for program

Posted 20 January 2010 - 06:18 PM

View Postpapuccino1, on 20 Jan, 2010 - 05:14 PM, said:

I'd do something like:
<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.
Was This Post Helpful? 0
  • +
  • -

#12 MentalFloss  Icon User is offline

  • "ADDICTED"[2:5]
  • member icon

Reputation: 528
  • View blog
  • Posts: 1,397
  • Joined: 02-September 09

Re: Database for program

Posted 20 January 2010 - 06:19 PM

Quote

I'd do something like:

<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

Was This Post Helpful? 0
  • +
  • -

#13 blank_program  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 11
  • View blog
  • Posts: 284
  • Joined: 22-July 09

Re: Database for program

Posted 20 January 2010 - 06:21 PM

View PostMentalFloss, on 20 Jan, 2010 - 05:19 PM, said:

Quote

I'd do something like:

<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

Was This Post Helpful? 0
  • +
  • -

#14 papuccino1  Icon User is offline

  • His name was Robert Paulson.
  • member icon

Reputation: 63
  • View blog
  • Posts: 1,121
  • Joined: 02-March 08

Re: Database for program

Posted 20 January 2010 - 06:32 PM

In order to write to an XML file, you need to use a very nice .NET Class:

XmlTextWriter textWriter = new XmlTextWriter("C:\\myFile.xml", null) ;

Read more in depth information here:
http://www.c-sharpco...utmellli21.aspx
Was This Post Helpful? 0
  • +
  • -

#15 blank_program  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 11
  • View blog
  • Posts: 284
  • Joined: 22-July 09

Re: Database for program

Posted 20 January 2010 - 06:35 PM

View Postpapuccino1, on 20 Jan, 2010 - 05:32 PM, said:

In order to write to an XML file, you need to use a very nice .NET Class:

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.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2