Teen Programmers Unite  


Return to forum top

What language should be used to...

Posted by bw27 [send private reply] at July 04, 2002, 01:48:04 AM

What is the best language to use if i wanted a program to display information from a database. Here's the situatoin:

My local rotary group is having a lotto type drawing. everybody buys a ticket and gets a number. These people are then put into a database that contains their name and the number on the ticket. then the balls are drawn, and the last ball drawn wins. I need a program that asks for the number that was drawn, the user inputs the number, then theres a fancy display of the persons name and their number (and possibly a message like "better luck next year"). i mean fancy like big bold letters in a cool font, not in DOS. any suggestions??

Posted by bw27 [send private reply] at July 04, 2002, 01:57:24 AM

also, if anybody knows of a program that already does something like this or where I could look to find one, that would be appreciated too. thanks

Posted by CodeRed [send private reply] at July 04, 2002, 01:58:16 AM

Shouldn't be hard in C++ with Win32. The database thing is no big deal, I assume it will hold under 1000 entries so a simple data structure should suffice

Posted by bw27 [send private reply] at July 04, 2002, 02:13:06 AM

i think theres only 300 entries if i remember correctly. my c++ is kind of weak (i took it in my first 2 years of college and got c's & d's). what do you mean by win32. also, the only c++ i have access to is borland v.5.

what im really looking for is a quick solution to this. perhaps somebody could help me through it. i do however appreciate any help that can be given.

Posted by metamorphic [send private reply] at July 04, 2002, 06:23:03 AM

A very quick way of doing it would be to use Visual basic to do it and use things like the ADODC control. That is poviding your using access for the database. If you want to do that, making a front end is no problem.

Posted by Psion [send private reply] at July 04, 2002, 07:48:48 AM

You should be able to write a tiny program to do this in pretty much ANY programming language that supports file I/O, in about ten minutes of your time if you're familiar with the language you choose. When someone says "database" these days, he generally means something *much* more complicated than what you're suggesting. You can simply have an array of strings and select the element of the array with the same index as the number entered.

Posted by metamorphic [send private reply] at July 04, 2002, 07:54:19 AM

Depends what he is using already. If he has a DB set up already, ay as well use that.

Posted by bw27 [send private reply] at July 04, 2002, 12:23:47 PM

I would probably use access if its possible to do so. i would like to know more about this ADODC control. I had visual basic on CD but i cant seem to find it.

and I know that my "database" is just an array of two data items, but I figure access would be the easiest to make it

Posted by unknown_lamer [send private reply] at July 04, 2002, 12:59:48 PM

Just use php and make it a web page. Use mysql or postgresql for storing the entries; even if you only have a few it makes writing the app much easier.

e.g. If you have a db named lotto_entries (postgresql):

( name text,
  number integer,
  id serial

  ON entries
  TO "www-data";
  ON  entries_id_seq
  TO "www-data";

You could then have a simple php script to insert the entries, another one (or even the same page, doesn't really matter) to enter the winning number and fetch the winners and print their names in a "cool font" (use CSS and not <font> :). You could probably even use access (I haven't used php on Windows, so I have no idea if there is a module for it) for the db.
Posted by metamorphic [send private reply] at July 04, 2002, 02:32:30 PM

Prob with php and mysql is you would have to set it up. VB and access wont ake long to set up and can run on any windows with the vbru time files. And yes, i know there is PHP triad, but VB and access just seems easier. The ADO control can be found in the compontent list, you just need to add it to a project.

Posted by gian [send private reply] at July 04, 2002, 03:41:36 PM

Why not just do like Psion and Codered said and use a bit of simple file i/o and do it that way? It's sure to be the simplest way of doing things, and it will serve you better when it comes to learning some non-vb language.

Posted by eXorcus [send private reply] at July 05, 2002, 07:54:38 AM

I have to agree with metamorphic on this one...We had an assignment for a simple DB in class once, and using the Visual Data manager that comes with VB, and the DB control included with the standard controls for all projects we were able to set up a very functional DB program with more tables than this problem needs in half an hour. RAD and ease of use are definately VB's strong points =P.

Would be cool to use Perl or PHP to have a web based DB though, if your up to it bw27. I recommend www.cgi101.com for learning Perl, has a really good beginner's tutorial and teaches basic file I/O with flat plaintext DBs which should be sufficient for this application I'm sure.

Posted by bw27 [send private reply] at July 08, 2002, 11:01:06 AM

Thank you everybody. your advice was very helpful, and i think im going to try the VB method eXorcus and several others suggested. thanks again.

You must be logged in to post messages and see which you have already read.

Log on
Save for later automatic logon

Register as a new user
Copyright TPU 2002. See the Credits and About TPU for more information.