You've lost me on the text file notion. You want to store the information in a database. A table for games, a table for companies, a table for ESRB ratings, a table for platforms and a table for genres; you may also want an associative table between games and companies. Visual Studio integrates into SQL Server. If you're planning on making this a learning experience, make it about learning databases. Plan it well, use it well. And make damn sure it's normalized.
C# can do web requests with the HttpWebRequest object, but it's not really a language I'd go with for that task (Perl or PHP are better suited to that, in my opinion), but it's doable.
---
Tell me to get back to rewriting this site so it's not horrible on mobileWhatever you're doing or however you approach it, I'm here to help as well.
---
Tell me to get back to rewriting this site so it's not horrible on mobileI have no idea where to begin with a database. Don't have the slightest clue of what would be involved, code-wise. Do you have any specific tips regarding the code, or is C# not within your area of expertise? If I need to, I'll just browse some coding communities (which is how I was planning on finding coding info and advice in general, anyway).
Angry_Beaver said:So are you saying I should put the info in a spreadsheet?
By all that is unholy please no.
Visual Studio Express runs SQL Express. You can use that for databases.
I'm a bit rusty on the .NET stuff, but conceptually you follow the same patterns regardless. It sounds as though you're doing a Windows Form project, and not a web project, is that right?
For just connecting once the database and tables already exist...
The general logic for reading from a database in pseudo-code tends to be this,
open database connection
results = execute SQL statment
loop through results
do something with the row
end loop
close database connection
To interact with the databse, you use Structured Query Language (SQL). It's not very difficult for most things and is pretty straight-forward. There are some minor differences between MSSQL and MySQL, for example, but it's generally consistent.
Here's an example in C# that selects the column "title" from the table "games" from the database "MyDatabase", for every title that includes the string "Mario", then goes through an gives you a message box for each game.
string connString = "Data Source=localhostSqlExpress;Initial Catalog=MyDatabase;Integrated Security=True";
SqlConnection conn = new SqlConnection(connString);
conn.Open();
sqlComm = new SqlCommand("SELECT title FROM games WHERE title LIKE '%Mario%'", conn);
SqlDataReader reader = sqlComm.ExecuteReader(CommandBehavior.CloseConnection);
while(reader.Read())
{
System.Windows.Forms.MessageBox.Show("Game Title: " + reader["title"].ToString());
}
conn.Close();
However, before you get to any of this, you have to actually create your database stuff. Visual Studio has a panel called the Server Explorer that shows your connection to the database server and all your databases and tables, and allows you to create tables. Relational database tables are laid out like a spreadsheet (i.e. a table), but no, this is not like working with Excel.
There are GUI tools there for creating everything. But as an example, here's the MySQL (I'm not 100% sure if there are differences in this example for MSSQL) syntax for creating a table
CREATE TABLE games (
id INT AUTO_INCREMENT,
title VARCHAR(100),
score DECIMAL(3,1),
PRIMARY KEY(id)
);
AUTO_INCREMENT specifies that when you add a new row, the id is generated automatically to be unique, VARCHAR is a text field, the number beside it is the max length; it differs from CHAR in that if you use say 5 characters, VARCHAR will just store the 5 characters, whereas CHAR will pad the remaining 95 characters with spaces. DECIMAL(3,1) indicates 3 digits with one decimal place, that is 00.0. And PRIMARY KEY indicates the primary key, which is the unique identifier for each row.
---
Tell me to get back to rewriting this site so it's not horrible on mobileYou can install WAMP (stands for Windows, Apache, MySQL and PHP) for Windows development in PHP.
Do whatever interests you and/or whatever is most important towards your future goals. If you do head into PHP territory, I can provide you with some tools get you ahead -- probably the most useful being a database class to greatly simplify querying a database.
An example
<?php
require_once('Database.class.php');
$db = Database::getDatabase();
$rows = $db->query("SELECT title FROM games WHERE MATCH(title) AGAINST(?)", $_GET['search']);
print_r($rows);
?>
If you want some examples of good PHP code, I have a few open-source projects you can see here: http://github.com/derekhamilton/. I'd recommend taking a look at LazyStructure, which is meant to be a launching point for websites, and I did my damndest to keep the code as clean and proper as possible.
---
Tell me to get back to rewriting this site so it's not horrible on mobileThe whole thing sounds like a massive task to this coding novice, though, so if you're eager to add an included feature to the site, don't hold your breath for me -- go ahead and do it at your leisure.
Angry_Beaver said:Well, I was thinking that this could be a pretty complete game info thingamabob, with spaces of a sort for each game. Anyone who provides the site with news updates could link them to the respective game. And then everything important about the game, including news, could be discovered with the search feature that was more or less my initial idea.
The whole thing sounds like a massive task to this coding novice, though, so if you're eager to add an included feature to the site, don't hold your breath for me -- go ahead and do it at your leisure.
I've already been pushing my luck just getting people to click categories. Getting them to associate games ain't gonna fly. Gotta be automated in some fashion -- tricky, but not impossible.
Anything even remotely resembling this is on the back-burner anyway. Whole lot of redesigning taking precedence, but additional projects.
---
Tell me to get back to rewriting this site so it's not horrible on mobile