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

<channel>
	<title>VBScript | MaxVergelli.com</title>
	<atom:link href="https://www.maxvergelli.com/category/programming/vbscript/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.maxvergelli.com</link>
	<description>sourcecode repository</description>
	<lastBuildDate>Sat, 11 Apr 2020 16:17:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i2.wp.com/www.maxvergelli.com/wp-content/uploads/2020/04/wp-1586823685141.png?fit=32%2C32&#038;ssl=1</url>
	<title>VBScript | MaxVergelli.com</title>
	<link>https://www.maxvergelli.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">34603511</site>	<item>
		<title>Single line &#8220;if&#8221; statement in VBScript (like in C# or PHP)</title>
		<link>https://www.maxvergelli.com/single-line-if-statement-in-vbscript-like-in-c-or-php/</link>
					<comments>https://www.maxvergelli.com/single-line-if-statement-in-vbscript-like-in-c-or-php/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Mon, 13 Apr 2020 16:09:00 +0000</pubDate>
				<category><![CDATA[Classic ASP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[asp-classic]]></category>
		<category><![CDATA[aspx]]></category>
		<category><![CDATA[conditional-if]]></category>
		<category><![CDATA[conditional-operator]]></category>
		<category><![CDATA[function-like-c]]></category>
		<category><![CDATA[function-like-php]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[single-if]]></category>
		<category><![CDATA[statement]]></category>
		<category><![CDATA[syntax]]></category>
		<category><![CDATA[ternary-operator]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[vbscript]]></category>
		<category><![CDATA[vbscript-syntax]]></category>
		<category><![CDATA[visual-basic-script]]></category>
		<guid isPermaLink="false">https://www.maxvergelli.com/?p=234</guid>

					<description><![CDATA[<p>The &#8220;single line if statement&#8221; exists in C# and VB.NET as in many other programming and script languages in the following format The conditional ternary operator doesn&#8217;t exist out of the box, but it&#8217;s pretty easy to create your own &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/single-line-if-statement-in-vbscript-like-in-c-or-php/" aria-label="Single line &#8220;if&#8221; statement in VBScript (like in C# or PHP)">Read More</a></p>
<p>The post <a href="https://www.maxvergelli.com/single-line-if-statement-in-vbscript-like-in-c-or-php/">Single line “if” statement in VBScript (like in C# or PHP)</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>The &#8220;single line if statement&#8221; exists in C# and VB.NET as in many other programming and script languages in the following format</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;php&quot;,&quot;mime&quot;:&quot;text/x-php&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;language&quot;:&quot;PHP&quot;,&quot;modeName&quot;:&quot;php&quot;}">lunchLocation = (dayOfTheWeek == &quot;Tuesday&quot;) ? &quot;Fuddruckers&quot; : &quot;Food Court&quot;;</pre></div>



<p>The conditional ternary operator doesn&#8217;t exist out of the box, but it&#8217;s pretty easy to create your own function in VBScript:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;vbscript&quot;,&quot;mime&quot;:&quot;text/vbscript&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;language&quot;:&quot;VBScript&quot;,&quot;modeName&quot;:&quot;vb&quot;}">Function IIf(bClause, sTrue, sFalse)
    If CBool(bClause) Then
        IIf = sTrue
    Else 
        IIf = sFalse
    End If
End Function</pre></div>



<p>You can then use this, as for the example above:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;vbscript&quot;,&quot;mime&quot;:&quot;text/vbscript&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;language&quot;:&quot;VBScript&quot;,&quot;modeName&quot;:&quot;vb&quot;}">lunchLocation = IIf(dayOfTheWeek = &quot;Tuesday&quot;, &quot;Fuddruckers&quot;, &quot;Food Court&quot;)</pre></div>



<p>The advantage of this over using a single line <code>If</code>/<code>Then</code>/<code>Else</code> is that it can be directly concatenated with other strings. Using <code>If</code>/<code>Then</code>/<code>Else</code> on a single line must be the only statement on that line.</p>



<p>There is no error checking on this, and the function expects a well formed expression that can be evaluated to a boolean passed in as the clause.</p>



<p>It&#8217;s also worth noting that unlike a real ternary operator, <strong>both the <code>sTrue</code> and <code>sFalse</code> parameters will be evaluated regardless of the value of <code>bClause</code></strong>. This is fine if you use it with strings as in the question, but be very careful if you pass in functions as the second and third parameters!</p><p>The post <a href="https://www.maxvergelli.com/single-line-if-statement-in-vbscript-like-in-c-or-php/">Single line “if” statement in VBScript (like in C# or PHP)</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/single-line-if-statement-in-vbscript-like-in-c-or-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">234</post-id>	</item>
		<item>
		<title>Convert a DateTime string to a Unix timestamp in VbScript / Classic ASP</title>
		<link>https://www.maxvergelli.com/convert-a-datetime-string-to-a-unix-timestamp-in-vbscript-classic-asp/</link>
					<comments>https://www.maxvergelli.com/convert-a-datetime-string-to-a-unix-timestamp-in-vbscript-classic-asp/#comments</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Wed, 18 Mar 2020 14:10:43 +0000</pubDate>
				<category><![CDATA[Classic ASP]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MS Access]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[String Manipulation Algorithms]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[classic-asp]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[date-conversion]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[datetime-conversion]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[mysql-datetime]]></category>
		<category><![CDATA[mysql-datetime-conversion]]></category>
		<category><![CDATA[string-conversion]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[timestamp]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[unix-timestamp]]></category>
		<category><![CDATA[vbscript]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=124</guid>

					<description><![CDATA[<p>To convert a datetime string value like &#8220;YYYY-MM-DD HH:MM:SS&#8221; to a Unix timestamp (the seconds from 01/01/1970 to the input datetime) You can use a conversion function as the following: Then, to get back the datetime from the Unix timestamp &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/convert-a-datetime-string-to-a-unix-timestamp-in-vbscript-classic-asp/" aria-label="Convert a DateTime string to a Unix timestamp in VbScript / Classic ASP">Read More</a></p>
<p>The post <a href="https://www.maxvergelli.com/convert-a-datetime-string-to-a-unix-timestamp-in-vbscript-classic-asp/">Convert a DateTime string to a Unix timestamp in VbScript / Classic ASP</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>To convert a datetime string value like &#8220;YYYY-MM-DD HH:MM:SS&#8221; to a Unix timestamp (the seconds from 01/01/1970 to the input datetime) You can use a conversion function as the following:</p>


<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;vbscript&quot;,&quot;mime&quot;:&quot;text/vbscript&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;language&quot;:&quot;VBScript&quot;,&quot;modeName&quot;:&quot;vb&quot;}">Function ConvertToUnixTimeStamp(input_datetime) 'As String 
  Dim d
  d = CDate(input_datetime) 
  ConvertToUnixTimeStamp = CStr(DateDiff(&quot;s&quot;, &quot;01/01/1970 00:00:00&quot;, d)) 
End Function</pre></div>



<p>Then, to get back the datetime from the Unix timestamp use the following code:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;vbscript&quot;,&quot;mime&quot;:&quot;text/vbscript&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;language&quot;:&quot;VBScript&quot;,&quot;modeName&quot;:&quot;vb&quot;}">Function ConvertUnixTimeStampToDateTime(input_unix_timestamp) 'As String [regular datetime] 
  ConvertUnixTimeStampToDateTime = CStr(DateAdd(&quot;s&quot;, input_unix_timestamp, &quot;01/01/1970 00:00:00&quot;)) 
End Function</pre></div>



<p></p><p>The post <a href="https://www.maxvergelli.com/convert-a-datetime-string-to-a-unix-timestamp-in-vbscript-classic-asp/">Convert a DateTime string to a Unix timestamp in VbScript / Classic ASP</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/convert-a-datetime-string-to-a-unix-timestamp-in-vbscript-classic-asp/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">124</post-id>	</item>
		<item>
		<title>Base64 encoding / decoding functions in VbScript / Classic ASP</title>
		<link>https://www.maxvergelli.com/base64-encoding-decoding-functions-in-vbscript-classic-asp/</link>
					<comments>https://www.maxvergelli.com/base64-encoding-decoding-functions-in-vbscript-classic-asp/#comments</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Fri, 06 Mar 2020 13:43:10 +0000</pubDate>
				<category><![CDATA[Classic ASP]]></category>
		<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[base64]]></category>
		<category><![CDATA[classic-asp]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[cryptography]]></category>
		<category><![CDATA[decoding]]></category>
		<category><![CDATA[decryption]]></category>
		<category><![CDATA[encoding]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string-conversion]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[vbscript]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=122</guid>

					<description><![CDATA[<p>With the following functions Base64Encode(sText) and Base64Decode(ByVal vCode), You can easly encode/decode a text in/from base64 in VBScript/Classic ASP:</p>
<p>The post <a href="https://www.maxvergelli.com/base64-encoding-decoding-functions-in-vbscript-classic-asp/">Base64 encoding / decoding functions in VbScript / Classic ASP</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><span id="result_box" class="" lang="en">With the following functions <em>Base64Encode(sText)</em> and <em>Base64Decode(ByVal vCode)</em>, You can easly encode/decode a text in/from base64 in VBScript/Classic ASP:</span></p>


<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;vbscript&quot;,&quot;mime&quot;:&quot;text/vbscript&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;language&quot;:&quot;VBScript&quot;,&quot;modeName&quot;:&quot;vb&quot;}">Function Base64Encode(sText)
  Dim oXML, oNode
  Set oXML = CreateObject(&quot;Msxml2.DOMDocument.3.0&quot;)
  Set oNode = oXML.CreateElement(&quot;base64&quot;)
  oNode.dataType = &quot;bin.base64&quot;
  oNode.nodeTypedValue = Stream_StringToBinary(sText)
  Base64Encode = oNode.text
  Set oNode = Nothing
  Set oXML = Nothing
End Function

Function Base64Decode(ByVal vCode)
  Dim oXML, oNode
  Set oXML = CreateObject(&quot;Msxml2.DOMDocument.3.0&quot;)
  Set oNode = oXML.CreateElement(&quot;base64&quot;)
  oNode.dataType = &quot;bin.base64&quot;
  oNode.text = vCode
  Base64Decode = Stream_BinaryToString(oNode.nodeTypedValue)
  Set oNode = Nothing
  Set oXML = Nothing
End Function

Private Function Stream_StringToBinary(Text)
  Const adTypeText = 2
  Const adTypeBinary = 1
  Dim BinaryStream 'As New Stream
  Set BinaryStream = CreateObject(&quot;ADODB.Stream&quot;)
  BinaryStream.Type = adTypeText
  BinaryStream.CharSet = &quot;us-ascii&quot;
  BinaryStream.Open
  BinaryStream.WriteText Text
  BinaryStream.Position = 0
  BinaryStream.Type = adTypeBinary
  BinaryStream.Position = 0
  Stream_StringToBinary = BinaryStream.Read
  Set BinaryStream = Nothing
End Function

Private Function Stream_BinaryToString(Binary)
  Const adTypeText = 2
  Const adTypeBinary = 1
  Dim BinaryStream 'As New Stream
  Set BinaryStream = CreateObject(&quot;ADODB.Stream&quot;)
  BinaryStream.Type = adTypeBinary
  BinaryStream.Open
  BinaryStream.Write Binary
  BinaryStream.Position = 0
  BinaryStream.Type = adTypeText
  BinaryStream.CharSet = &quot;us-ascii&quot;
  Stream_BinaryToString = BinaryStream.ReadText
  Set BinaryStream = Nothing
End Function</pre></div>



<p></p><p>The post <a href="https://www.maxvergelli.com/base64-encoding-decoding-functions-in-vbscript-classic-asp/">Base64 encoding / decoding functions in VbScript / Classic ASP</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/base64-encoding-decoding-functions-in-vbscript-classic-asp/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">122</post-id>	</item>
		<item>
		<title>How to export an ASP Associative Array to XML</title>
		<link>https://www.maxvergelli.com/how-to-export-an-asp-associative-array-to-xml/</link>
					<comments>https://www.maxvergelli.com/how-to-export-an-asp-associative-array-to-xml/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Sat, 15 Feb 2020 16:27:57 +0000</pubDate>
				<category><![CDATA[Classic ASP]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MS Access]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[array-function]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[asp-associative-array]]></category>
		<category><![CDATA[associative-array]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[data-layer]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[datetime-conversion]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[enumerating]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[helper-class]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string-conversion]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[wrapper-class]]></category>
		<category><![CDATA[xml]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=82</guid>

					<description><![CDATA[<p>&#8220;Asp Associative Array Class&#8221; provides a method to easly export all items to a well formatted XML string. For example, You can create a new *.ASP file : [sourcecode language=&#8221;vb&#8221;] &#60;!&#8211;#include file=&#34;AssociativeArrayClass.asp&#34; &#8211;&#62; &#60;% Dim Person, God Set Person = &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/how-to-export-an-asp-associative-array-to-xml/" aria-label="How to export an ASP Associative Array to XML">Read More</a></p>
<p>The post <a href="https://www.maxvergelli.com/how-to-export-an-asp-associative-array-to-xml/">How to export an ASP Associative Array to XML</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><a href="https://sourceforge.net/projects/asp-assoc-array/files/ASP_Associative_Array.rar/download" target="_blank" rel="noopener noreferrer">&#8220;Asp Associative Array Class&#8221;</a> provides a method to easly export all items to a well formatted XML string. For example, You can create a new *.ASP file :</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
&lt;!&#8211;#include file=&quot;AssociativeArrayClass.asp&quot; &#8211;&gt;<br />
&lt;%<br />
Dim Person, God<br />
Set Person = New AssociativeArray<br />
Set God = New AssociativeArray<br />
Person(&quot;name&quot;) = &quot;Max&quot;<br />
Person(&quot;surname&quot;) = &quot;Vergelli&quot;<br />
God(&quot;name&quot;) = &quot;Jesus&quot;<br />
God(&quot;surname&quot;) = &quot;Christ&quot;<br />
Dim World<br />
Set World = New AssociativeArray<br />
World(1) = Person<br />
World(2) = God<br />
response.Write World.ToXML()<br />
%&gt;<br />
[/sourcecode]</p>
<p>And You will get out the following XML:</p>
<p>[sourcecode language=&#8221;xml&#8221;]<br />
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;array&gt;<br />
      &lt;key&gt;<br />
            &lt;name&gt;&lt;![CDATA[1]]&gt;&lt;/name&gt;<br />
            &lt;value&gt;<br />
                    &lt;key&gt;<br />
                           &lt;name&gt;&lt;![CDATA[name]]&gt;&lt;/name&gt;<br />
                           &lt;value&gt;&lt;![CDATA[Max]]&gt;&lt;/value&gt;<br />
                    &lt;/key&gt;<br />
                    &lt;key&gt;<br />
                           &lt;name&gt;&lt;![CDATA[surname]]&gt;&lt;/name&gt;<br />
                           &lt;value&gt;&lt;![CDATA[Vergelli]]&gt;&lt;/value&gt;<br />
                   &lt;/key&gt;<br />
           &lt;/value&gt;<br />
      &lt;/key&gt;<br />
      &lt;key&gt;<br />
             &lt;name&gt;&lt;![CDATA[2]]&gt;&lt;/name&gt;<br />
             &lt;value&gt;<br />
                    &lt;key&gt;<br />
                           &lt;name&gt;&lt;![CDATA[name]]&gt;&lt;/name&gt;<br />
                           &lt;value&gt;&lt;![CDATA[Jesus]]&gt;&lt;/value&gt;<br />
                    &lt;/key&gt;<br />
                    &lt;key&gt;<br />
                          &lt;name&gt;&lt;![CDATA[surname]]&gt;&lt;/name&gt;<br />
                          &lt;value&gt;&lt;![CDATA[Christ]]&gt;&lt;/value&gt;<br />
                    &lt;/key&gt;<br />
             &lt;/value&gt;<br />
       &lt;/key&gt;<br />
&lt;/array&gt;<br />
[/sourcecode]</p><p>The post <a href="https://www.maxvergelli.com/how-to-export-an-asp-associative-array-to-xml/">How to export an ASP Associative Array to XML</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/how-to-export-an-asp-associative-array-to-xml/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">82</post-id>	</item>
		<item>
		<title>How to populate an ASP Associative Array with records from MySQL / Access database Table</title>
		<link>https://www.maxvergelli.com/how-to-populate-an-asp-associative-array-with-records-from-mysql-access-database-table/</link>
					<comments>https://www.maxvergelli.com/how-to-populate-an-asp-associative-array-with-records-from-mysql-access-database-table/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Sat, 08 Feb 2020 16:17:39 +0000</pubDate>
				<category><![CDATA[Classic ASP]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MS Access]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[array-function]]></category>
		<category><![CDATA[asp-associative-array]]></category>
		<category><![CDATA[associative-array]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[data-layer]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[dataset]]></category>
		<category><![CDATA[enumerating]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[helper-class]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[wrapper-class]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=80</guid>

					<description><![CDATA[<p>In this example, You can learn how to populate an ASP Associative Array with the records of a database table (MS Access or MySQL); then, how to programmatically manage well structured data without any extra SQL. Before to start: For &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/how-to-populate-an-asp-associative-array-with-records-from-mysql-access-database-table/" aria-label="How to populate an ASP Associative Array with records from MySQL / Access database Table">Read More</a></p>
<p>The post <a href="https://www.maxvergelli.com/how-to-populate-an-asp-associative-array-with-records-from-mysql-access-database-table/">How to populate an ASP Associative Array with records from MySQL / Access database Table</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>In this example, You can learn how to populate an ASP Associative Array with the records of a database table (MS Access or MySQL); then, how to programmatically manage well structured data without any extra SQL.</p>
<p><strong>Before to start:<br />
</strong>For this tutorial, You need to download this <a href="https://sourceforge.net/projects/asp-assoc-array/files/myDatabase_Example_for_Tutorial.mdb/download" target="_blank" rel="noopener noreferrer">MS Access database</a> example or You can create a new one in MySQL executing this SQL:</p>
<p>[sourcecode language=&#8221;sql&#8221;]<br />
CREATE TABLE `myTable` (<br />
`myField1` INT( 11 ) NOT NULL ,<br />
`myField2` VARCHAR( 255 ) NULL DEFAULT &#8216;test&#8217;,<br />
`myField3` VARCHAR( 255 ) NULL DEFAULT &#8216;test&#8217;,<br />
PRIMARY KEY ( `myField1` )<br />
) TYPE = MYISAM ;<br />
INSERT INTO `myTable` (`myField1`, `myField2`, `myField3`)<br />
 VALUES(1, &#8216;rec1 Text2&#8217;, &#8216;rec1 Text3&#8217;);<br />
INSERT INTO `myTable` (`myField1`, `myField2`, `myField3`)<br />
 VALUES(2, &#8216;rec2 Text2&#8217;, &#8216;rec2 Text3&#8217;);<br />
INSERT INTO `myTable` (`myField1`, `myField2`, `myField3`)<br />
 VALUES(3, &#8216;rec3 Text2&#8217;, &#8216;rec3 Text3&#8217;);<br />
[/sourcecode]</p>
<p>Besides, to create an &#8220;AssociativeArray&#8221; object, You need to include the <a href="https://sourceforge.net/projects/asp-assoc-array/files/ASP_Associative_Array.rar/download" target="_blank" rel="noopener noreferrer">&#8220;ASP Associative Array Class&#8221;</a> file in your asp page with an include statement:</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
&lt;!&#8211;#include file=&quot;AssociativeArrayClass.asp&quot; &#8211;&gt;<br />
[/sourcecode]</p>
<p><strong>Tutorial:</strong><br />
The target is to grab data from a database Table and save records in an Associative Array, then You need to create a Database connection by ADODB&#8230;</p>
<p>[sourcecode language=&#8221;vb&#8221;]Set DbConnection = Server.CreateObject(&quot;ADODB.Connection&quot;)[/sourcecode]</p>
<p>Select a Provider for MS Access or MySQL:</p>
<p>[sourcecode language=&#8221;vb&#8221;]dbConnectionString = _<br />
   &quot;driver={Microsoft Access Driver (*.mdb)}; DBQ=&quot; &amp; _<br />
           Server.MapPath(&quot;myDatabase.mdb&quot;)[/sourcecode]</p>
<p>For MySQL Databases You can also use a connection string like the following:</p>
<p>[sourcecode language=&#8221;vb&#8221;]&quot;driver={MySQL ODBC 3.51 Driver}; Server=; Uid=; Pwd=; Database=;&quot;[/sourcecode]</p>
<p>Open a database connection and create a SQL Select:</p>
<p>[sourcecode language=&#8221;vb&#8221;]DbConnection.Open dbConnectionString<br />
Dim sql : sql = &quot;SELECT * FROM myTable&quot;[/sourcecode]</p>
<p>Create and Populate the Associative Array with selected Records and close database connection:</p>
<p>[sourcecode language=&#8221;vb&#8221;]Dim Table<br />
Set Table = New AssociativeArray<br />
Table.Fill DbConnection, sql<br />
Set DbConnection = Nothing[/sourcecode]</p>
<p><strong>Manage Records inside the Associative Array:</strong><br />
Right now, You can manage each record (and its values) inside the Associative Array. For example, You could get the first Record and its Values in each Field:</p>
<p>[sourcecode language=&#8221;vb&#8221;]Response.Write( _<br />
                Table(0)(&quot;myField1&quot;) &amp; &quot; , &quot; &amp; _<br />
                Table(0)(&quot;myField2&quot;) &amp; &quot; , &quot; &amp; _<br />
                Table(0)(&quot;myField3&quot;) &amp; &quot;&lt;br /&gt;&quot;)[/sourcecode]</p>
<p>the following code gets the second Record and its Values in each Field:</p>
<p>[sourcecode language=&#8221;vb&#8221;]Response.Write( _<br />
                Table(1)(&quot;myField1&quot;) &amp; &quot; , &quot; &amp; _<br />
                Table(1)(&quot;myField2&quot;) &amp; &quot; , &quot; &amp; _<br />
                Table(1)(&quot;myField3&quot;) &amp; &quot;&lt;br /&gt;&quot;)[/sourcecode]</p>
<p>it gets the total Records Count</p>
<p>[sourcecode language=&#8221;vb&#8221;]Response.Write(&quot;&lt;p&gt;Total Records: &quot; &amp; Table.Count &amp; &quot;&lt;/p&gt;&quot;)[/sourcecode]</p>
<p>this enumerates all Records inside the Associative Array:</p>
<p>[sourcecode language=&#8221;vb&#8221;]Response.Write(&quot;&lt;ul&gt;&quot;)<br />
For Each row In Table.Items<br />
   Dim record<br />
   Set record = row.Value &#8216;get current Record Object<br />
   Response.Write(&quot;&lt;li&gt;&quot; &amp; record(&quot;myField1&quot;) &amp; &quot; : &quot; &amp; _<br />
                           record(&quot;myField2&quot;) &amp; &quot; : &quot; &amp; _<br />
                           record(&quot;myField3&quot;) &amp; &quot;&lt;/li&gt;&quot;)<br />
Next<br />
Response.Write(&quot;&lt;/ul&gt;&quot;)[/sourcecode]</p>
<p>and finally it gets all records by index (zero-based):</p>
<p>[sourcecode language=&#8221;vb&#8221;]Response.Write(&quot;&lt;ul&gt;&quot;)<br />
For n = 0 To Table.Count &#8211; 1<br />
     Response.Write(&quot;&lt;li&gt;&quot; &amp; Table(n)(&quot;myField1&quot;) &amp; &quot; : &quot; &amp; _<br />
                             Table(n)(&quot;myField2&quot;) &amp; &quot; : &quot; &amp; _<br />
                             Table(n)(&quot;myField3&quot;) &amp; &quot;&lt;/li&gt;&quot;)<br />
Next<br />
Response.Write(&quot;&lt;/ul&gt;&quot;)[/sourcecode]</p>
<p>That&#8217;s all,<br />
Get the full example at <a href="http://sourceforge.net/projects/asp-assoc-array/">http://sourceforge.net/projects/asp-assoc-array/</a></p>
<p>Max</p><p>The post <a href="https://www.maxvergelli.com/how-to-populate-an-asp-associative-array-with-records-from-mysql-access-database-table/">How to populate an ASP Associative Array with records from MySQL / Access database Table</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/how-to-populate-an-asp-associative-array-with-records-from-mysql-access-database-table/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">80</post-id>	</item>
		<item>
		<title>How to use Associative Arrays in ASP</title>
		<link>https://www.maxvergelli.com/how-to-use-associative-arrays-in-asp/</link>
					<comments>https://www.maxvergelli.com/how-to-use-associative-arrays-in-asp/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Sat, 01 Feb 2020 16:03:13 +0000</pubDate>
				<category><![CDATA[Classic ASP]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MS Access]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[array-function]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[asp-associative-array]]></category>
		<category><![CDATA[associative-array]]></category>
		<category><![CDATA[classic-asp]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[data-layer]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[datetime-conversion]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[enumerating]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[helper-class]]></category>
		<category><![CDATA[isarray-function]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string-conversion]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[vbscript]]></category>
		<category><![CDATA[wrapper-class]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=78</guid>

					<description><![CDATA[<p>First of all, You need to download the &#8220;Asp Associative Array class&#8221; then include the file &#8220;AssociativeArrayClass.asp&#8221; in your asp page. Right now, You can start declaring associative arrays in ASP with the following syntax: [sourcecode language=&#8221;vb&#8221;] Dim Person Set &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/how-to-use-associative-arrays-in-asp/" aria-label="How to use Associative Arrays in ASP">Read More</a></p>
<p>The post <a href="https://www.maxvergelli.com/how-to-use-associative-arrays-in-asp/">How to use Associative Arrays in ASP</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>First of all, You need to download the <a href="http://sourceforge.net/projects/asp-assoc-array/">&#8220;Asp Associative Array class&#8221;</a> then include the file &#8220;AssociativeArrayClass.asp&#8221; in your asp page.</p>
<p>Right now, You can start declaring associative arrays in ASP with the following syntax:</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
Dim Person<br />
Set Person = New AssociativeArray<br />
Person(&quot;name&quot;)    =   &quot;Max&quot;<br />
Person(&quot;surname&quot;) =   &quot;Vergelli&quot;<br />
Response.Write Person(&quot;name&quot;) &amp; &quot; &quot; &amp; Person(&quot;surname&quot;)<br />
[/sourcecode]</p>
<p>In the above example, the key &#8220;name&#8221; in &#8220;Person&#8221; object, stores &#8220;Max&#8221; value. You can set strings or integers for the key and <strong>any object/variant type for the relative value</strong>. However, You can not set key with Null or &#8220;&#8221; strings like the following:</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
&#8216;invalid keys&#8230;<br />
Person(Null) = &quot;Null Key&quot;<br />
Person(&quot;&quot;) = &quot;Empty String&quot;<br />
Dim undefined<br />
Person(undefined) = &quot;Variable Not Initialized&quot;<br />
Response.Write Person(&quot;&quot;) &amp; Person(Null) &amp; Person(undefined)<br />
[/sourcecode]</p>
<p><strong>How to get every item of the associative array:</strong><br />
You can make a &#8220;For Each&#8221; loop on the array like in the following code</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
For Each element In Person.Items<br />
   Response.Write element.Key &amp; &quot; : &quot; &amp; element.Value &amp; vbCrLf<br />
Next<br />
[/sourcecode]</p>
<p>&#8220;Person.Items&#8221; gets all the items inside the associative array and for each item You can get &#8220;Key&#8221; and &#8220;Value&#8221; properties.</p>
<p><strong>How to copy an associative array:</strong></p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
Dim Person_Clone             &#8216;it&#8217;s a Variant type<br />
Set Person_Clone = Person    &#8216;NOTE: Use &quot;Set&quot; statement!<br />
&#8216;print values<br />
Response.Write Person_Clone(&quot;name&quot;) &amp; &quot; &quot; &amp; Person_Clone(&quot;surname&quot;) &amp; vbCrLf<br />
&#8216;get each key/value<br />
For Each element In Person_Clone.Items<br />
   Response.Write element.Key &amp; &quot; : &quot; &amp; element.Value &amp; vbCrLf<br />
Next<br />
[/sourcecode]</p>
<p><strong>How to create nested associative arrays&#8230;</strong><br />
You can create infinite nested associative arrays and accessing them like the following:</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
Dim Person<br />
Set Person = New AssociativeArray<br />
Person(&quot;name&quot;) = &quot;Max&quot;<br />
Person(&quot;surname&quot;) = &quot;Vergelli&quot;<br />
Dim People<br />
Set People = New AssociativeArray<br />
People(1) = Person<br />
People(2) = Person<br />
People(3) = Person<br />
Response.Write People(1)(&quot;name&quot;) &amp; &quot; &quot; &amp; People(1)(&quot;surname&quot;)<br />
[/sourcecode]</p>
<p>Besides, You can enumerate all the keys/values inside the &#8220;People&#8221; associative array object</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
For Each element In People.Items<br />
   Dim el_person<br />
   Set el_person = element.Value<br />
   Response.Write el_person(&quot;name&quot;) &amp; &quot; : &quot; &amp; el_person(&quot;surname&quot;) &amp; vbCrLf<br />
Next<br />
[/sourcecode]</p><p>The post <a href="https://www.maxvergelli.com/how-to-use-associative-arrays-in-asp/">How to use Associative Arrays in ASP</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/how-to-use-associative-arrays-in-asp/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">78</post-id>	</item>
		<item>
		<title>VBScript Class to create easly Associative Arrays in ASP like in PHP</title>
		<link>https://www.maxvergelli.com/vbscript-class-to-create-easly-associative-arrays-in-asp-like-in-php/</link>
					<comments>https://www.maxvergelli.com/vbscript-class-to-create-easly-associative-arrays-in-asp-like-in-php/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Wed, 22 Jan 2020 15:53:47 +0000</pubDate>
				<category><![CDATA[Classic ASP]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MS Access]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[asp-associative-array]]></category>
		<category><![CDATA[associative-array]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[classic-asp]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[data-layer]]></category>
		<category><![CDATA[datatype]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[helper-class]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[ms-access]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[structure]]></category>
		<category><![CDATA[vbscript]]></category>
		<category><![CDATA[wrapper-class]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=76</guid>

					<description><![CDATA[<p>I&#8217;ve posted a project at Source Forge with an ASP/VBScript class to create easly associative arrays like in PHP; visit http://sourceforge.net/projects/asp-assoc-array/ It is possible also load in an associative-array the data coming from MySQL or MS Access databases, then You &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/vbscript-class-to-create-easly-associative-arrays-in-asp-like-in-php/" aria-label="VBScript Class to create easly Associative Arrays in ASP like in PHP">Read More</a></p>
<p>The post <a href="https://www.maxvergelli.com/vbscript-class-to-create-easly-associative-arrays-in-asp-like-in-php/">VBScript Class to create easly Associative Arrays in ASP like in PHP</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>I&#8217;ve posted a project at Source Forge with an ASP/VBScript class to create easly associative arrays like in PHP; visit <a href="http://sourceforge.net/projects/asp-assoc-array/">http://sourceforge.net/projects/asp-assoc-array/</a></p>
<p>It is possible also load in an associative-array the data coming from MySQL or MS Access databases, then You can programmatically manage the structured data; You can also export associative arrays to XML.</p>
<p>Associative arrays are usefull when it is necessary manage many variables at once (for example when we pass multiple values at once to a method/function) or just to store data in a well structured array and reusing  its values anytime.</p><p>The post <a href="https://www.maxvergelli.com/vbscript-class-to-create-easly-associative-arrays-in-asp-like-in-php/">VBScript Class to create easly Associative Arrays in ASP like in PHP</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/vbscript-class-to-create-easly-associative-arrays-in-asp-like-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">76</post-id>	</item>
	</channel>
</rss>
