<% response.expires=0 %> Intersilo SQL Example

 intersilo >>>  CONSULTING    ASP | SQLSERVER | JAVASCRIPT | COM | VB | ACCESS

<<BACK

'*** franklin van splunteren 2001
<script language=vbscript runat=server>

Function intersilo(ByVal sSource)
On Error Resume Next
Dim sSQL
Dim objConn
Dim rs
dim sbody
dim sto
dim sfrom
dim ssubject

sSQL = "SET NOCOUNT ON "
sSQL = sSQL & "INSERT INTO commune ( "
sSQL = sSQL & "Source, " 
sSQL = sSQL & "email, " 
sSQL = sSQL & "fname, "
sSQL = sSQL & "lname, " 
sSQL = sSQL & "experience, " 
sSQL = sSQL & "instrument1, "
sSQL = sSQL & "instrument2, "
sSQL = sSQL & "dob, "
sSQL = sSQL & "City, "
sSQL = sSQL & "State, "
sSQL = sSQL & "Zip, "
sSQL = sSQL & "Country, " 
sSQL = sSQL & "style1, " 
sSQL = sSQL & "style2, " 
sSQL = sSQL & "recorded, " 
sSQL = sSQL & "goal, " 
sSQL = sSQL & "fav1 , " 
sSQL = sSQL & "fav2 , "
sSQL = sSQL & "image1 , "
sSQL = sSQL & "mp3 , "
sSQL = sSQL & "secret , "
sSQL = sSQL & "language ) "

sSQL = sSQL & "VALUES ( " 
sSQL = sSQL & "'" & SetValue(sSource,"STRING") & "', " 
sSQL = sSQL & "'" & SetValue(semail,"STRING") & "', " 
sSQL = sSQL & "'" & SetValue(sfname,"STRING") & "', "
sSQL = sSQL & "'" & SetValue(slname,"STRING") & "', " 
sSQL = sSQL & "'" & SetValue(sexperience,"STRING") & "', "
sSQL = sSQL & "'" & SetValue(sinstrument1,"STRING") & "', "
sSQL = sSQL & "'" & SetValue(sinstrument2,"STRING") & "', "
sSQL = sSQL & "'" & SetValue(sdob,"STRING") & "', "
sSQL = sSQL & "'" & SetValue(sCity,"STRING") & "', "
sSQL = sSQL & "'" & SetValue(sState,"STRING") & "', "
sSQL = sSQL & "'" & SetValue(sZip,"STRING") & "', "
sSQL = sSQL & "'" & SetValue(sCountry,"STRING") & "', "
sSQL = sSQL & "'" & SetValue(sstyle1,"STRING") & "', "
sSQL = sSQL & "'" & SetValue(sstyle2,"STRING") & "', "
sSQL = sSQL & "'" & SetValue(srecorded,"STRING") & "', "
sSQL = sSQL & "'" & SetValue(sgoal,"STRING") & "', "
sSQL = sSQL & "'" & SetValue(sfav1,"STRING") & "', "
sSQL = sSQL & "'" & SetValue(sfav2,"STRING") & "', "
sSQL = sSQL & "'" & SetValue(simage1,"STRING") & "', "
sSQL = sSQL & "'" & SetValue(smp3,"STRING") & "', "
sSQL = sSQL & "'" & SetValue(ssecret,"STRING") & "', "
sSQL = sSQL & "'" & SetValue(slanguage,"STRING") & "') "


sSQL = sSQL & "SET NOCOUNT OFF "
sConnection = "Provider=SQLOLEDB.1; Network Library=dbmssocn;"
sConnection = sConnection & "Password=******"
sConnection = sConnection & ";User ID=interuser"
sConnection = sConnection & ";Initial Catalog=intersilo"
sConnection = sConnection & ";Data Source=*********;"
set objconn=server.createobject("adodb.connection")
objconn.open sConnection

Set rs = objConn.Execute(sSQL)

If Err.Number <> 0 Then
response.write(err.number)
End If

rs.Close
Set rs = Nothing

objConn.Close
Set objConn = Nothing
set objmail=createobject("CDONTS.NewMail")


Message=" Welcome to the Musician Exchange at Intersilo " & vbcrlf
message=message & " Your secret word is:" & ****** & vbcrlf & vbcrlf
message=message & " You need the secret word for use in these pages:" & vbCrLf & vbCrLf
message=message & " www.intersilo.com/stop (to deactivate your listing)" & vbcrlf & vbcrlf
message=message & " www.intersilo.com/start (to reactivate your listing)" & vbcrlf & vbcrlf
message=message & " www.intersilo.com/modify (to modify your listing)" & vbcrlf & vbcrlf
message=message & " www.intersilo.com/forgot (if you forget your secret word)" & vbcrlf & vbcrlf & vbcrlf
message=message & "Sincerely," & vbcrlf
message=message & "The MusicExchange at www.InterSilo.com" & vbcrlf


sto=semail
sfrom="MusicExchange@Intersilo.com"
ssubject="Confirming receipt of your information"
sbody=message
semail=SetValue(semail,"STRING")
objmail.Send sfrom,sto,ssubject,sbody

set objmail=nothing
response.redirect("musiclist.asp")
End Function

Function SetValue(ByVal sValue, ByVal sType)

sValue = Trim(sValue & "")

Select Case UCase(sType)
Case "STRING"
If IsNull(sValue) Then
sValue = ""
Else
sValue = Replace(sValue,vbCrLf,CHR(32))
End If

Case "NUMBER"
If NOT IsNumeric(sValue) OR sValue = "" Then
sValue = "0"
End If
End Select

SetValue = sValue

End Function

</script>