Tutors can be so unimaginative! Frequently they ask students to convert years to the Roman equivalent, and so dutifully you go off and re-invent the wheel. AGAIN.
Now, you won't have to! Just download a small ZIP file, decompress it to your My Documents folder, and add a small piece of code - easy! You might want to change the comments a bit, a few of the names perhaps to make it look like you wrote it, but Hey! That's easier than actually working out how to do it, isn't it?
Procedure: Download the conversion database here
] and unzip it to your My Documents folder. Note that this conversion works from the founding of Rome (start of Ab Urbe Condita as you would expect) to the end of the Gregorian calender in 4246
To make it easier, this is an SQLCE database, which means it is small, compact and does not require SQL Server or MySQL to be installed - it works with the .NET SqlServerCe assembly which is installed with .NET automatically. Additionally, it means this will work with Windows CE or Windows Mobile!
Add a reference in your project to the "System.Data.SqlServerCe" assembly, and a "
" to the top of your source file.
Then just paste the following code into your app and use the GetRomanDate method.
private string GetRomanDate(int year)
return GetRomanDate(year, false); }
private string GetRomanDate(int year, bool abUrbeCondita)
using (SqlCeConnection con = new SqlCeConnection(@"Data Source=" + Environment.GetFolderPath(Environment.SpecialFolder.Personal) + @"\RomanDates.sdf;Persist Security Info=True"))
string sql = "SELECT * FROM Years WHERE Year=@YEAR";
using (SqlCeCommand cmd = new SqlCeCommand(sql, con))
using (SqlCeDataReader dr = cmd.ExecuteReader())
return (dr.Read() ? (string) dr[(abUrbeCondita ? "AbUrbeCondita" : "Roman")] : "Outside the bounds of time!");