|
utilizzazione di un db
inserimento: parte 1 - form
inserimento: parte 2 - sql
' controllo delle variabili, ove obbligatorie
If IsEmpty(request.form("Name")) or request.form("Name")="" then
response.write "You must enter a name."
response.write ""
response.end
Else
Name = request.form("Name")
End If
If IsEmpty(request.form("City")) or request.form("City")="" then
response.write "You must enter a City."
response.write ""
response.endElse
City = request.form("City")
End If
' variabili NON obbligatorie
State = request.form("State")
' costruzione sql INSERT
SQLstmt = "INSERT INTO Sample (Name,City,State,Country)"
SQLstmt = SQLstmt & " VALUES (" SQLstmt = SQLstmt & "'" & Name & "',"
SQLstmt = SQLstmt & "'" & City & "',"SQLstmt = SQLstmt & "'" & State & "',"
SQLstmt = SQLstmt & "'" & Country & "'"SQLstmt = SQLstmt & ")"
' esecuzione
set conn = server.createobject("adodb.connection")
conn.open "kathi"
Set RS = conn.execute(SQLstmt)
Conn.Close
� bene verificare gli errori
|