<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Alfa BBT &#187; SQLite</title>
	<atom:link href="http://blog.koenvermoesen.be/tag/sqlite/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.koenvermoesen.be</link>
	<description>Allways looking for a better Blog Title...</description>
	<lastBuildDate>Tue, 13 Jul 2010 09:33:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.koenvermoesen.be' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/72db48a689a5327f7bba8c9193cac8af?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>Alfa BBT &#187; SQLite</title>
		<link>http://blog.koenvermoesen.be</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.koenvermoesen.be/osd.xml" title="Alfa BBT" />
	<atom:link rel='hub' href='http://blog.koenvermoesen.be/?pushpress=hub'/>
		<item>
		<title>Hooking up SQLite and PowerShell</title>
		<link>http://blog.koenvermoesen.be/2008/11/03/hooking-up-sqlite-and-powershell/</link>
		<comments>http://blog.koenvermoesen.be/2008/11/03/hooking-up-sqlite-and-powershell/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 13:36:00 +0000</pubDate>
		<dc:creator>Koen Vermoesen</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://k0v3.wordpress.com/?p=192</guid>
		<description><![CDATA[I&#8217;ve been playing around with SQLite on the command line (cmd that is) a bit. I immediately started wondering if it would be possible to combine this portable SQL engine with PowerShell, but I couldn&#8217;t find any working samples on the internet. After some more research I discovered the SQLite ADO.net 2.0 Provider but I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=192&subd=k0v3&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around with <a title="Zero-configuration SQL database engine" href="SQLite" target="_blank">SQLite</a> on the command line (cmd that is) a bit. I immediately started wondering if it would be possible to combine this portable SQL engine with <a title="Windows PowerShell Blog" href="http://blogs.msdn.com/PowerShell/">PowerShell</a>, but I couldn&#8217;t find any working samples on the internet.</p>
<p>After some more research I discovered the <a title="An open source ADO.NET provider for the SQLite database engine" href="http://sqlite.phxsoftware.com/">SQLite ADO.net 2.0 Provider</a> but I couldn&#8217;t get it to work immediately.</p>
<p>It took me a couple of days to find the blog post <a title="Database Queries with Windows Powershell" href="http://blog.jeffreymcmanus.com/762/database-queries-with-windows-powershell/">Database Queries with Windows Powershell</a>. (This blog seems to have moved recently as most of the hyperlinks/search results are still referring to Typepad). The post is nicely commented, so I could rather easily translate the MySQL to SQLite statements with some assistance from the included help file.</p>
<pre><span style="color:#ff6600;">[void][System.Reflection.Assembly]::LoadFrom("D:\DATA\Tools\System.Data.SQLite.dll")

$cn = New-Object -TypeName System.Data.SQLite.SQLiteConnection
$cn.ConnectionString = "Data Source=D:\DATA\Tools\koen.sqlite"
$cn.Open()

$cm = New-Object -TypeName System.Data.SQLite.SQLiteCommand
$sql = "SELECT FirstName, LastName FROM tblKoen"
$cm.Connection = $cn
$cm.CommandText = $sql
$dr = $cm.ExecuteReader()

while ($dr.Read())
{
    write-host $dr.GetString(0) " " $dr.GetString(1)
}

$cn.Close()</span></pre>
<p>Some more interesting links I came across:</p>
<ul>
<li><a title="SQL Tutorial" href="http://www.w3schools.com/sql/default.asp">Learn SQL</a></li>
<li><a title="SQLite ODBC Driver" href="http://www.ch-werner.de/sqliteodbc/">SQLite ODBC driver</a></li>
<li><a title="SQLite Tutorial" href="http://souptonuts.sourceforge.net/readme_sqlite_tutorial.html">SQLite Tutorial</a></li>
</ul>
<br />Posted in Scripting Tagged: PowerShell, SQLite <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/k0v3.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/k0v3.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/k0v3.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/k0v3.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/k0v3.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/k0v3.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/k0v3.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/k0v3.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/k0v3.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/k0v3.wordpress.com/192/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=192&subd=k0v3&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.koenvermoesen.be/2008/11/03/hooking-up-sqlite-and-powershell/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f646bcfc3f7534b20fa79e0347353eb?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">k0v3</media:title>
		</media:content>
	</item>
	</channel>
</rss>