<?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/"
	>

<channel>
	<title>Random Web Tools &#187; asp</title>
	<atom:link href="http://www.randomtools.net/tag/asp/feed" rel="self" type="application/rss+xml" />
	<link>http://www.randomtools.net</link>
	<description>Advice and tools from a young web developer</description>
	<lastBuildDate>Mon, 16 Aug 2010 06:16:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>ASP File_Get_Contents and File_Put_Contents</title>
		<link>http://www.randomtools.net/asp-file_get_contents-and-file_put_contents-36.html</link>
		<comments>http://www.randomtools.net/asp-file_get_contents-and-file_put_contents-36.html#comments</comments>
		<pubDate>Wed, 10 Jun 2009 06:20:10 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[asp]]></category>

		<guid isPermaLink="false">http://www.randomtools.net/?p=36</guid>
		<description><![CDATA[As I&#39;ve become more of a PHP developer than an ASP developer, one thing I&#39;ve noticed is that it is 10x easier to read/write text files with PHP. Simple use file_get_contents() and be done. ASP isn&#39;t so nice. But it can be done, so I&#39;m creating those for simplicity here: &#60;% Function File_Get_Contents(strFile) Set objFSO [...]]]></description>
			<content:encoded><![CDATA[<p>As I&#39;ve become more of a PHP developer than an ASP developer, one thing I&#39;ve noticed is that it is 10x easier to read/write text files with PHP. Simple use file_get_contents() and be done. ASP isn&#39;t so nice. But it can be done, so I&#39;m creating those for simplicity here:</p>
<pre class="brush: vb">&lt;%
Function File_Get_Contents(strFile)
	Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
	Set objFile = objFSO.OpenTextFile(strFile, 1)
	File_Get_Contents = objFile.ReadAll()
	Set objFile = Nothing
	Set objFSO = Nothing
End Function

Function File_Put_Contents(strFile, strContents, blnAppend)
	If blnAppend Then
		intMode = 8
	Else
		intMode = 2
	End If
	Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
	Set objFile = objFSO.OpenTextFile(strFile, intMode, True)
	objFile.Write(strContents)
	Set objFile = Nothing
	Set objFSO = Nothing
End Function
%&gt;</pre>
<p>Of course this file_get_contents doesn&#39;t support remote URLs, but it can easily be added.</p>
<p><div style="width: 300px; height: 250px; margin: 3px;"><script type="text/javascript"><!--
google_ad_client = "pub-1936238606905173";
google_ad_slot = "4013486594";
google_ad_width = 300;
google_ad_height = 250;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div></p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='title' title='Use these links to share this page with others'>Bookmark this page</div><div class='linkbuttons'><a href='http://del.icio.us/post?url=http://www.randomtools.net/asp-file_get_contents-and-file_put_contents-36.html&amp;title=ASP File_Get_Contents and File_Put_Contents' title='Save to del.icio.us' onclick='target="_blank";' rel='nofollow'><img src='http://www.randomtools.net/wp-content/plugins/bookmarkify/delicious.png' style='width:16px; height:16px;' alt='[del.icio.us] ' /></a> <a href='http://digg.com/submit?phase=2&amp;url=http://www.randomtools.net/asp-file_get_contents-and-file_put_contents-36.html&amp;title=ASP File_Get_Contents and File_Put_Contents' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.randomtools.net/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://www.facebook.com/share.php?u=http://www.randomtools.net/asp-file_get_contents-and-file_put_contents-36.html' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://www.randomtools.net/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' /></a> <a href='http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.randomtools.net/asp-file_get_contents-and-file_put_contents-36.html&amp;title=ASP File_Get_Contents and File_Put_Contents' title='Save to Google Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.randomtools.net/wp-content/plugins/bookmarkify/google.png' style='width:16px; height:16px;' alt='[Google] ' /></a> <a href='http://reddit.com/submit?url=http://www.randomtools.net/asp-file_get_contents-and-file_put_contents-36.html&amp;title=ASP File_Get_Contents and File_Put_Contents' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://www.randomtools.net/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a> <a href='http://slashdot.org/bookmark.pl?url=http://www.randomtools.net/asp-file_get_contents-and-file_put_contents-36.html&amp;title=ASP File_Get_Contents and File_Put_Contents' title='Slashdot It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.randomtools.net/wp-content/plugins/bookmarkify/slashdot.png' style='width:16px; height:16px;' alt='[Slashdot] ' /></a> <a href='http://www.stumbleupon.com/submit?url=http://www.randomtools.net/asp-file_get_contents-and-file_put_contents-36.html&amp;title=ASP File_Get_Contents and File_Put_Contents' title='Stumble It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.randomtools.net/wp-content/plugins/bookmarkify/stumbleupon.png' style='width:16px; height:16px;' alt='[StumbleUpon] ' /></a> </div></div>]]></content:encoded>
			<wfw:commentRss>http://www.randomtools.net/asp-file_get_contents-and-file_put_contents-36.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Classic ASP: More Efficient Database Recordset, GetRows() XoiseRecordset</title>
		<link>http://www.randomtools.net/classic-asp-more-efficient-database-recordset-xoiserecordset-15.html</link>
		<comments>http://www.randomtools.net/classic-asp-more-efficient-database-recordset-xoiserecordset-15.html#comments</comments>
		<pubDate>Fri, 01 Aug 2008 02:24:33 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[recordset]]></category>

		<guid isPermaLink="false">http://www.randomtools.net/classic-asp-more-efficient-database-recordset-xoiserecordset-15.html</guid>
		<description><![CDATA[I&#8217;ve created what I believe to be a more efficient recordset object for traversing rows returned from a database query. I implemented all methods/properties that I feel make sense to implement. There&#8217;s definite room for improvement, but it&#8217;s a good start. My reasoning for creating this is that I like the functionality of using recordsets [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve created what I believe to be a more efficient recordset object for traversing rows returned from a database query.  I implemented all methods/properties that I feel make sense to implement.  There&#8217;s definite room for improvement, but it&#8217;s a good start.  My reasoning for creating this is that I like the functionality of using recordsets (via Server.CreateObject(&quot;ADODB.Recordset&quot;)), but there is a HUGE drawback in that it is horrible on the database.  The Server.CreateObject approach makes a database call every time a EOF, BOF, or a traversal method (ie. MoveNext, MovePrevious, etc.) is called.</p>
<p>My fix is to use the GetRows() method to return it as a multidimensional array and just implement my own class with the same (or similar) functionality.  There is also an advantage to using this Recordset over just plain using the GetRows() method.  I went ahead and implemented a way to extract the column names from the query, which allows you to grab the information using the column name, instead of the index of the array (ie. objRS(&quot;Column_Name&quot;)).  You may also access the data using the column index if you prefer.&nbsp;Note that I haven&#8217;t implemented support for &quot;SELECT * FROM Tbl&#8230;&quot; syntax, so you&#8217;ll HAVE to use the index for this.</p>
<p>There is one main usage difference to note.  Rather than opening the recordset with .Open SQL_String, Connection_Object, you must individually update the .Conn and .SQL properties.  I&#8217;ll most likely change this if there is enough interest and I create a newer version.  If I do that, I&#8217;ll most likely provide cache support.</p>
<p>Download: <a href="/scripts/xoiserecordset.php">XoiseRecordset.zip</a> (1.29KB)<br /><iframe src="/scripts/shownumdownloads.php" style="border-style: none; width: 500px; height: 20px;" scrollbars="no"></iframe></p>
<p><u><strong>Usage:</strong></u><!-- #Include File = "XoiseRecordset.inc" --></p>
<p>Retrieve Data:</p>
<ul>
<li>objRS(&quot;Column_Name&quot;)</li>
<li>objRS.Item(&quot;ColumnName&quot;)</li>
<li>objRS.Row(0)</li>
</ul>
<p>Implemented Methods/Properties:</p>
<ul>
<li>Conn</li>
<li>SQL</li>
<li>EOF()</li>
<li>BOF()</li>
<li>MoveNext()</li>
<li>MoveFirst()</li>
<li>MoveFirst()</li>
<li>MoveLast()</li>
<li>Move()</li>
<li>GetRows()</li>
<li>RecordCount()</li>
<li>PageCount()</li>
<li>PageSize()</li>
<li>AbsolutePage()</li>
<li>AbsolutePosition()</li>
</ul>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='title' title='Use these links to share this page with others'>Bookmark this page</div><div class='linkbuttons'><a href='http://del.icio.us/post?url=http://www.randomtools.net/classic-asp-more-efficient-database-recordset-xoiserecordset-15.html&amp;title=Classic ASP: More Efficient Database Recordset, GetRows() XoiseRecordset' title='Save to del.icio.us' onclick='target="_blank";' rel='nofollow'><img src='http://www.randomtools.net/wp-content/plugins/bookmarkify/delicious.png' style='width:16px; height:16px;' alt='[del.icio.us] ' /></a> <a href='http://digg.com/submit?phase=2&amp;url=http://www.randomtools.net/classic-asp-more-efficient-database-recordset-xoiserecordset-15.html&amp;title=Classic ASP: More Efficient Database Recordset, GetRows() XoiseRecordset' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.randomtools.net/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://www.facebook.com/share.php?u=http://www.randomtools.net/classic-asp-more-efficient-database-recordset-xoiserecordset-15.html' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://www.randomtools.net/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' /></a> <a href='http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.randomtools.net/classic-asp-more-efficient-database-recordset-xoiserecordset-15.html&amp;title=Classic ASP: More Efficient Database Recordset, GetRows() XoiseRecordset' title='Save to Google Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.randomtools.net/wp-content/plugins/bookmarkify/google.png' style='width:16px; height:16px;' alt='[Google] ' /></a> <a href='http://reddit.com/submit?url=http://www.randomtools.net/classic-asp-more-efficient-database-recordset-xoiserecordset-15.html&amp;title=Classic ASP: More Efficient Database Recordset, GetRows() XoiseRecordset' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://www.randomtools.net/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a> <a href='http://slashdot.org/bookmark.pl?url=http://www.randomtools.net/classic-asp-more-efficient-database-recordset-xoiserecordset-15.html&amp;title=Classic ASP: More Efficient Database Recordset, GetRows() XoiseRecordset' title='Slashdot It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.randomtools.net/wp-content/plugins/bookmarkify/slashdot.png' style='width:16px; height:16px;' alt='[Slashdot] ' /></a> <a href='http://www.stumbleupon.com/submit?url=http://www.randomtools.net/classic-asp-more-efficient-database-recordset-xoiserecordset-15.html&amp;title=Classic ASP: More Efficient Database Recordset, GetRows() XoiseRecordset' title='Stumble It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.randomtools.net/wp-content/plugins/bookmarkify/stumbleupon.png' style='width:16px; height:16px;' alt='[StumbleUpon] ' /></a> </div></div>]]></content:encoded>
			<wfw:commentRss>http://www.randomtools.net/classic-asp-more-efficient-database-recordset-xoiserecordset-15.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
