codice:
strIndirizzo=Replace(strIndirizzo,"'"," ")
strData=Replace(strData,"-","/")
if (MID(strData, 7, 8)) > 10 then
strDataIns = MID(strData, 4, 2) & "/" & MID(strData, 1, 2) & "/" & "19" & MID(strData, 7, 8)
else
strDataIns = MID(strData, 4, 2) & "/" & MID(strData, 1, 2) & "/" & "20" & MID(strData, 7, 8)
end if
'response.write (MID(strData, 7, 8))
' strNumeroSocio = int(strNumeroSocio)
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Driver={SQL Server}; Server=localhost; Database=portoflioBoseTest; Uid=web1Test; Pwd=bose1test;"
SqlInsert = "SELECT numeroSocio, nome, cognome FROM dimension WHERE numeroSocio = '" & strNumeroSocio & "' AND nome = '" & strNome & "' AND cognome = '" & strCognome & "'"
Set rsInsert = Conn.Execute(SqlInsert)
If rsInsert.EOF Then
strSQL = "INSERT INTO dimension (numeroSocio, saluto, nome, cognome, indirizzo, cap, citta, provincia, prefisso, telefono, email, eta, modello, data, matricola1, matricola2, rivenditore, localita, commenti, privacy, eta2) Values('"&strNumeroSocio&"', '"&strSaluto&"','"&strNome&"','"&strCognome&"','"&strIndirizzo&"','"&strCap&"','"&strCitta&"','"&strProvincia&"','"&strPrefisso&"','"&strTelefono&"','"&strEmail&"','"&strEta&"','"&strModello&"','"&strDataIns&"','"&strMatricola1&"','"&strMatricola2&"','"&strRivenditore&"','"&strLocalita&"','"&strCommenti&"','"&strPrivacy&"','"&strEta2&"')"
'response.write strSQL
'conn.Execute strSQL
Set RECdown = CreateObject("ADODB.Recordset")
set RECdown = conn.execute(strSQL)
Else
Response.Write strNumeroSocio & "" & strNome & "" & strCognome
Response.Write(" è già presente nel database.
")
End If
rsInsert.Close
Set rsInsert = Nothing
end if
conta=conta+1
Loop
objFile.Close
Set objFile = Nothing
Set fs = Nothing
conn.Close
Set conn = Nothing
Se l'anno è superiore a 10 dovrà mettere 19 altrimenti 20.