Ho realizzato questa pagina in .asp:
(riporto soltanto la parte in .asp)
<%
Dim Attivita, Categoria, Indirizzo, Citta, Provincia, Email, Referente, Telefono, Fax, Cellulare
Attivita = request.form("txtAttivita")
Categoria = request.form("cmbCategoria")
Indirizzo = request.form("txtIndirizzo")
Citta = request.form("txtCitta")
Provincia = request.form("cmbProvincia")
Email = request.form("txtEmail")
Referente = request.form("txtReferente")
Telefono = request.form("txtTelefono")
Fax = request.form("txtFax")
Cellulare = request.form("txtCellulare")
'********* CREAZIONE STRINGA DI VERIFICA
Dim sDefaultChars
Dim iCounter
Dim iPickedChar
Dim iDefaultCharactersLength
Dim iPasswordLength
'Inizializzo
sDefaultChars="ABCDEFGHIJKLMNOPQRSTUVXYZ0123456789 "
iPasswordLength=20
iDefaultCharactersLength = Len(sDefaultChars)
Randomize'Generazione Random
For iCounter = 1 To iPasswordLength
'Next pick a number from 1 to length of character set
iPickedChar = Int((iDefaultCharactersLength * Rnd) + 1)
'Next pick a character from the character set using the random number iPickedChar
'and Mid function
Check = Check & Mid(sDefaultChars,iPickedChar,1)
Next
'************************************************* *****************
' INSERIMENTO NEL DATABASE
'************************************************* *****************
Dim Conn
Dim rstinserimenti
Dim strSQL
Set Conn = Server.CreateObject("ADODB.Connection")
%><%
Set rstinserimenti = Server.CreateObject("ADODB.Recordset")
strSQL="SELECT Email FROM Generale WHERE eMail='" & eMail & "'"
rstinserimenti.Open strSQL,Conn
if (rstinserimenti.bof) AND (rstinserimenti.eof) then
'******** INSERISCO NUOVA FIRMA NEL DATABASE
strSQL = "INSERT INTO Generale (Attivita, Categoria, Indirizzo, Citta, Provincia, Email, Referente, Telefono, Fax, Cellulare) VALUES ('" & Attivita & "', '" & Categoria & "', '" & Indirizzo & "', '" & Citta & "', '" & Provincia & "', '" & Email & "', '" & Referente & "', '" & Telefono & "', '" & Fax & "', '" & Cellulare & "')"
Conn.Execute(strSQL)
set rstinserimenti = nothing
set Conn = nothing
end if
%>
-------------------------------------
Il database si chiama inserimenti.mdb.
La pagina del form in .htm è:
<script language="JavaScript" type="text/javascript">
<!--
function checkform ( form )
{
// ** START **
if (form.txtAttivita.value == "") {
alert( "Il campo ATTIVITA non può essere vuoto" );
form.txtAttivita.focus();
return false ;
}
if (form.cmbCategoria.value == "X") {
alert( "Selezionare la CATEGORIA" );
form.cmbCategoria.focus();
return false ;
}
if (form.txtIndirizzo.value == "") {
alert( "Il campo INDIRIZZO non può essere vuoto" );
form.txtIndirizzo.focus();
return false ;
}
if (form.txtCitta.value == "") {
alert( "Il campo CITTA non può essere vuoto" );
form.txtCitta.focus();
return false ;
}
if (form.cmbProvincia.value == "X") {
alert( "Selezionare la PROVINCIA" );
form.cmbProvincia.focus();
return false ;
}
if (form.txtEmail.value == "") {
alert( "Il campo EMAIL non può essere vuoto" );
form.txtEmail.focus();
return false ;
}
if (form.txtReferente.value == "") {
alert( "Il campo REFERENTE non può essere vuoto" );
form.textReferente.focus();
return false ;
}
if (form.txtTelefono.value == "") {
alert( "Il campo TELEFONO non può essere vuoto" );
form.txtTelefono.focus();
return false ;
}
if (form.txtFax.value == "") {
alert( "Il campo FAX non può essere vuoto" );
form.textFax.focus();
return false ;
}
if (form.txtCellulare.value == "") {
alert( "Il campo CELLULARE non può essere vuoto" );
form.textCellulare.focus();
return false ;
}
// ** END **
return true ;
}
//-->
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<body onLoad="textticker()">
<form action="inserimento.asp" method="post" name="inserimento" onSubmit="return checkform(this);">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><table width="75%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="33%" class="TestoForm">Attivita</td>
<td width="67%"><input name="txtAttivita" type="text" size="60" maxlength="50" tabindex="0"></td>
</tr>
<tr>
<td class="TestoForm">Categoria :</td>
<td><select name="cmbCategoria" tabindex="4">
<option value="X" selected> --</option>
<option value="Abbigliamento">Abbigliamento</option>
<option value="Artigianato">Artigianato</option>
<option value="Bioedilizia">Bioedilizia</option>
<option value="Camapagne">Camapagne</option>
<option value="Centri">Centri</option>
<option value="Cooperative">Cooperative</option>
<option value="Erboristerie">Erboristerie</option>
<option value="Eventi">Eventi</option>
<option value="Gas">Gas</option>
<option value="Librerie">Librerie</option>
<option value="Negozi">Negozi</option>
<option value="Produttori">Produttori</option>
<option value="Ristoranti">Ristoranti</option>
<option value="Turismo">Turismo</option>
<option value="Vendita">Vendita</option>
</select> </td>
</tr>
<tr>
<td class="TestoForm">Indirizzo : </td>
<td><input name="txtIndirizzo" type="text" tabindex="2" size="60" maxlength="60"></td>
</tr>
<tr>
<td class="TestoForm">Città : </td>
<td><input name="txtCitta" type="text" tabindex="3" size="60" maxlength="50"></td>
</tr>
<tr>
<td class="TestoForm">Provincia : </td>
<td><select name="cmbProvincia" tabindex="4">
<option value="X" selected> --</option>
<option value="EE">EE</option>
...........................................
...........................................
</select> </td>
</tr>
<tr>
<td class="TestoForm">Indirizzo E-mail : </td>
<td><input name="txtEmail" type="text" tabindex="7" size="60" maxlength="60"></td>
</tr>
<tr>
<td class="TestoForm">Referente : </td>
<td><input name="txtReferente" type="text" tabindex="7" size="60" maxlength="60"></td>
</tr>
<tr>
<td class="TestoForm">Telefono : </td>
<td><input name="txtTelefono" type="text" tabindex="7" size="60" maxlength="60"></td>
</tr>
<tr>
<td class="TestoForm">Fax : </td>
<td><input name="txtFax" type="text" tabindex="7" size="60" maxlength="60"></td>
</tr>
<tr>
<td class="TestoForm">Cellulare : </td>
<td><input name="txtCellulare" type="text" tabindex="7" size="60" maxlength="60"></td>
</tr>
<tr>
<td colspan="2" align="center"></td>
</tr>
<tr>
<td colspan="2" align="center"><input name="btnInvia" type="submit" class="Bottone" tabindex="8" value="inserimento"></td>
</tr>
<tr>
<td colspan="2" align="center"></td>
</tr>
</table></td>
</tr>
</table>
</form>
------------------------------------------------------------------
C'è un prob che nn mi ricordo e che nn sono riuscito a trovare il parametro in .asp per i numeri
al posto di Telefono = request.form("txtTelefono").
Cmq mi da al momento in cui inserisco questa risposta:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
/inserimento.asp, line 61
Mi è già stato risposto due o tre volte, fatto correzioni ma mi continua a dare questo messaggio.....a me sembre tutto corretto!!!! dove sbaglio. Grazie

Rispondi quotando