Range of ServicesASP ProductsSample Code and TutorialsPartner InfoASP PortfolioContact Information    


The most useful sites to learn how to code ASP:

DevGuru.com (VbScript Index) | 4 Guys From Rolla (Good Tutorials... full scripts) | Downloadable Scripts

Here are some Unique and really useful SQL scripts especially if you need to import data to Go Daddy SQL Servers their CSV importer is useless.

Generate Random Password

Function generatePassword(intlength)

    Randomize
    For i = 1 to intlength
        tempPassword = tempPassword & Chr(Int(Rnd*26)+65)
    Next

    generatePassword=tempPassword


End Function

 

SQL Clean - doubles apostrophes to stop from breaking SQL and helps against malicious SQL strings.

Function SQLClean(strField As String) ' As String for VB.Net
  If Instr(strField, "'") Then
     SQLClean = Replace(Replace(strField, "'", "''"), vbCrLf, "")
  Else
     SQLClean = strField
  End If

End Function

Another way to go is Kevin Roth's Cleaner(Even if SQLClean is a Better name):

function RTESafe(strText)
'returns safe code for preloading in the RTE
dim tmpString

tmpString = trim(strText)

'convert all types of single quotes
tmpString = replace(tmpString, chr(145), chr(39))
tmpString = replace(tmpString, chr(146), chr(39))
tmpString = replace(tmpString, "'", "'")

'convert all types of double quotes
tmpString = replace(tmpString, chr(147), chr(34))
tmpString = replace(tmpString, chr(148), chr(34))
' tmpString = replace(tmpString, """", "\""")

'replace carriage returns & line feeds
tmpString = replace(tmpString, chr(10), " ")
tmpString = replace(tmpString, chr(13), " ")

RTESafe = tmpString
end function

See the Rich Text editor of his here: http://www.kevinroth.com/rte/demo.htm This should revolutionize your blogger.

Capitalize

Original Script Found at VoightKampffv1.0b Other useful scripts there too.

'store bogstaver i hvert ord i str, bruges til at give navne store bogstaver
'Translation: it capitalizes every word in a string(str).

function capitalize(str)


If Len(Trim(str))>0 Then
  prts = split(str, " ")
  for each item in prts
    if len(trim(item)) > 0 then
      capitalize = capitalize & " " & Ucase(left(item, 1)) & lcase(right(item, len(item)-1))
    end if
  next
  capitalize = trim(capitalize)
Else
  capitalize = str
End IF

end function

 
 

 

 
 

Questions? E-mail Mike.
© 2002-2007, ASP Consultant