This section contains a mixture of code snippets and downloads of useful little utilities that we have decided to make freely available.
- AFC Data Unloader
-
Have you ever wanted to transfer the data from a SQL Server table, but for various reasons cannot use BCP?
This little utility, written in C# 2.0 will generate a set of insert statements, taking into account identity columns.
Download it for free.
Requires .NET framework 2.0 - Stop Spam Bots
- Fed up with spam from bots scanning your web pages? Use this bit of Javascript to stop it. Visitors will see no difference. Add this function to your pageThen add this code for your mailto link (watch for line breaks - there should not be any)
<script type="text/javascript">
//<![CDATA[
function ddd(tag) {
var email=""
for (i=0;i<tag.length;)
{
email += tag.charAt(i);
i += 2
}
location.href = "mailto:" + email;
}
//]]>
</script><a href="javascript:ddd('e@nuq4u&iwr9evsk@@Y@O@U;RsC.Oj.;c:o¬.$u=k%')">email</a>If you read the letters in red you will see the email address, but this is not visible to spam-bots. Make the string as complex as you like, just remember to change the number of characters to jump in the loop. Simple but effective, like most of our code!With thanks to Simon Brown who told us the changes needed to make this function XHTML compliant. Simon noticed this while designing the inspirational Garden Design Unlimited web site.
- Loading and Saving to XML
- If you need to load an XML file into a dataset or save a
dataset to an XML file here's some code to do it.
Dim fle As String = "xmlfile1.xml"
Dim ds As System.Data.DataSet = New DataSet("myds")
ds.ReadXmlSchema(Server.MapPath("myxml.xsd")) 'this defines the xml structure
ds.ReadXml(fle) 'this loads the data
...do some work
ds.WriteXml(fle) 'this writes the data back
