Tuesday, May 4, 2010

A Walk To Panther Gorge

Monday; I wasn't planning on a hike, but after a few minutes of walking around the house, that was enough! The weather was clearing, so I packed up and headed North.
One of my favorite spots in the Adirondacks is the Elk Lake area. Macomb, Dixes, and Panther Gorge are all awesome places to explore.


Being a bit out of shape, I thought I'd take a relatively flat walk towards Panther Gorge. Well, as usual, I didn't make it all the way, but I did manage to get some nice pictures.


It looks like there is still some snow up high, from what I glimpsed on Marcy. But this will all be gone, soon, with a few more days like today. Surprisingly, the bugs weren't all that bad, with a little help from some deet.




Every time I'm out here, I have to laugh at how lucky I am to be able to venture through these hills!

"I went to the woods because I wished to live deliberately, to front only the essential facts of life, and see if I could not learn what it had to teach, and not, when I came to die, discover that I had not lived..."
H. D. Thoreau

Monday, December 28, 2009

SQLite and .Net

I needed a light weight database replacement for some of my SQL Server functions. Rather than using SQL Server Express, Access, Mysql, etc., all of which would require an awkward setup workaround, I found the SQLite for .Net as the perfect "drop-in" replacement. By simply including one .dll file in your project (and adding a reference to that .dll), you now have access to all of your SQL calls, through the SQLite database. You can find the download for the .Net version of SQLite here. Currently, I am using the 1.0.65.0 version, for my project. Additionally, I've found the sqliteadmin tool to be a nice editor for creating, editing data, and viewing all of my SQLite databases.
You'll find the .Net SQLite libraries can be used anywhere you might need to persist data, but don't have the option to use a full, distributed database.

To access your database, a simple connection, that includes the path, will allow you to connect as follows, using a datareader:

using System.Data.SQLite;
using System.Data;

public void getData()
{
try
{
SQLiteConnection sc = new SQLiteConnection("Data Source=" +
Application.StartupPath + "\\test1.s3db");
sc.Open();
SQLiteCommand scmd = new SQLiteCommand("Select * from main1", sc);
SQLiteDataReader dr = scmd.ExecuteReader();
while (dr.Read())
{
listBox1.Items.Add(dr[1].ToString() +
" " + dr[2].ToString());
}
dr.Close();
sc.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}