Wrox Programmer Forums
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 2nd, 2007, 07:20 PM
Authorized User
 
Join Date: Feb 2007
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default planner

Ok, here is the idea. I am trying to build a 'simple' date planner. The problem is that I don't know what to store the dates in. I was thinking of doing it in XML, but that appears to be to complicated for my level at the moment. Any ideas for another way to store it?

There are 10 types of people - Those who understand binary, and those who don't.
__________________
There are 10 types of people - Those who understand binary, and those who don\'t.
http://bschleusner.googlepages.com/home
 
Old April 3rd, 2007, 07:05 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Hmm. Personally I would use XML as you wouldn't need an overly complicated file to achieve a datasource for this particular application. In any case, ill foucs on using a database since you have indicated that XML is a bit complicated for you at present.

How you setup the database largely depends on what you are comfortable with but this is how I would do it.

Table: Event_Dates
Fields: pk (int, auto inc, no dupes), eventDate (datetime)

Table: Events
Fields: pk(int, auto inc, no dupes) event_fk (int), eventName (varchar) eventDescription(varchar)

This gives you a Many-to-one relationship (one date could potentially have many events) from the Event_dates table to the events table.

You link an event to a particular date based upon the event_dates.pk and events.event_fk relationship and to do so your query may look something like:

SELECT eventName, eventDescription FROM events where event_fk = (SELECT pk FROM event_dates where Convert(varchar(10), eventDate, 101) = '04/03/2007')

This query works but also contains a pitfall. If you do a straight insert into the Event_dates table without first checking to see if the date you are trying to insert already exists, the above query will throw an error to the effect of: Subquey can only contain one result.

And really, you should never need to have more then one instance of each date in the database but, if you would have a need to have multiple instances, you could rewrite your query to this:

SELECT eventName, eventDescription FROM events where event_fk IN (SELECT pk FROM event_dates where Convert(varchar(10), eventDate, 101) = '04/03/2007')

hth.



================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old April 4th, 2007, 03:57 PM
Authorized User
 
Join Date: Feb 2007
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What does a database consist of? Is it just datatable, datacolumn, and datarow? or is there some other form of database. I would like to know so that I know what to Google. Thanks.

There are 10 types of people - Those who understand binary, and those who don't.
 
Old April 4th, 2007, 09:09 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

O.o A database, for all intents and purposes can be ANY structured file. (Text File, excel sheet, etc) But yes, by and large a Database is comproised of Rows columns and tables, regardless of the format.

I am going to go out on a whim here, but am I right in guessing that you are fairly new to programming/computers in general?

There are plenty of Database Servers out there as well as Database applications (apps that create database files) so you have plenty of choices to chose from. If you want something low end and not full featured you can go with OpenOffice's Base applicaiton or with Microsofts Access application.

If you want to go more top end with a database server your free choice (amoung others) would be MySQL and on the not so free side, you have Microsoft SQL Server.

I would probably suggest access or base so you can get your feet wet with the SQL language but, if you feel you would be ok with a full fledge Server, go get MySQL and have at it!

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old April 5th, 2007, 01:07 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

There's also the free MS Sql Server 2005 Express (companion to the Express editions of the .Net development tools). It's a lighter weight version of the full version but it more than enough for someone looking to learn or develop against MS-SQL server. (The missing parts are parts that you would usually use in a production environment such as management tools and redundancy features.)

http://msdn.microsoft.com/vstudio/express/sql/

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
making a journey planner. Desperately need help! fabalyssa VB How-To 0 August 27th, 2007 12:13 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.