sto cercando di passare dei dati da questo form a mdb ma ricevio un errore:
Errore di compilazione di Microsoft VBScript (0x800A03EA)
Errore di sintassi
/firme02/addrecord.asp, line 18, column 181
sql = "INSERT INTO Tabella (matricola, nominativo, sportello, grado, mansione, LaData) VALUES ('"& matricola &"', '"&nominativo&"', '"&sportello&"', '"&grado&"', '"&mansione&"', '"&&"', '"& date() &"')
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^
Tipo di browser:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
Pagina:
POST 109 bytes to /firme02/addrecord.asp
POST Data:
matricola=31232&nominativo=fgfdfgfdgfdgdf&sportell o=1313&grado=3+AREA+3+LIV-I&mansione=ADDETTO+CENTRO+CORPOR.
questi i file:
addform.asp
<html>
<head>
<script type="text/javascript">
function validate(theForm)
{
for (var i = 0, n = theForm.elements.length; i < n; i ++)
{
currElem = theForm.elements[i];
if (currElem.type == "text" && currElem.value == "")
{
alert("Please fill in the " + currElem.id + " field");
currElem.focus();
return false;
}
if (currElem.type == "select-one" && currElem.value == "")
{
alert("Please select and option in the " + currElem.id + " dropdown");
currElem.focus();
return false;
}
}
return true;
}
</script>
<%
Dim strdb, conn, strcon
strDB = "Tabella.mdb"
Set Conn = Server.CreateObject("ADODB.Connection")
strCon = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=; DBQ=" & Server.MapPath(strDB)
Conn.Open strCon
Dim rsgrado, sqlgrado, rsmansione, sqlmansione
set rsgrado= server.createobject("ADODB.recordset")
set rsmansione= server.createobject("ADODB.recordset")
sqlgrado = "SELECT DISTINCT grado FROM Tabella1"
sqlmansione = "SELECT DISTINCT mansione FROM tabella1"
rsgrado.open sqlgrado, conn
rsmansione.open sqlmansione, conn
%>
</head>
<table>
<form method="post" action="addrecord.asp" name=theForm id=theForm onsubmit="return validate(this);">
<tr>
<td>Matricola</td>
<td><input type="text" name="matricola" maxlength="5" id="Matricola" class=forChecking></td>
</tr>
<tr>
<td>Nominativo</td>
<td><input type="text" name="nominativo" id="Nominativo" class=forChecking></td>
</tr>
<tr>
<td>Sportello</td>
<td><input type="text" name="sportello" id="Sportello" maxlength="4" class=forChecking onkeypress="if(isNaN(String.fromCharCode(event.key Code))){return false;}"></td>
</tr>
<tr>
<td>Grado</td>
<td><select name="grado" id="Grado">
<option value="">Scegli</option>
<%
if NOT rsgrado.eof Then
rsgrado.movefirst
While not rsgrado.eof
%>
<option value="<%=rsgrado("grado")%>"> <% = rsgrado("grado") %> </option>
<%
rsgrado.movenext
wend
End If
%>
</select>
</td>
</tr>
<tr>
<td>Mansione</td>
<td><select name="mansione" id="mansione">
<option value="">Scegli</option>
<%
if NOT rsmansione.eof Then
rsmansione.movefirst
While not rsmansione.eof
%>
<option value="<%=rsmansione("mansione")%>"> <% = rsmansione("mansione") %> </option>
<%
rsmansione.movenext
wend
End If
%>
</select>
</td>
</tr>
<tr><td colspan="2" align="center">
<input type="submit" value="Invia">
<input type="reset" value="Cancella">
</td>
</tr>
</form>
</table>
e addrecord.asp
<%
strDB = "Tabella.mdb"
Set Conn = Server.CreateObject("ADODB.Connection")
strCon = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=; DBQ=" & Server.MapPath(strDB)
Conn.Open strCon
Dim matricola, nominativo, sportello, grado, mansione
Matricola = request.form("matricola")
nominativo = request.form("nominativo")
sportello = request.form("sportello")
grado = request.form("grado")
mansione = request.form("mansione")
Dim sql
sql = "INSERT INTO Tabella (matricola, nominativo, sportello, grado, mansione, LaData) VALUES ('"& matricola &"', '"&nominativo&"', '"&sportello&"', '"&grado&"', '"&mansione&"', '"&&"', '"& date() &"')
Conn.execute(sql)
%>