ciao a tutti, ieri mi era arrivato il libro "Commercio elettronico in ASP, Guida completa", e mi sono messa subito al lavoro. In un capitolo mi ha fatto creare la pagina addproduct.asp con questo codice:
<html>
<head><title>Add Product </title></head>
<body bgcolor="gray">
<form method="post" action="manageproducts.asp">
<center>
<table width="600" border=1 bgcolor="lightyellow"
cellpadding="4" cellspacing="0">
<tr>
<td colspan="2" bgcolor="yellow">
<font face="Arial" size="3">
Add Product
</font>
</td>
</tr>
<tr>
<td>
Product Name:
</td>
<td>
<input name="productName"
size="50" maxlength="50">
</td>
</tr>
<tr>
<td>
Product Price:
</td>
<td>
<input name="productPrice" size="10">
</td>
</tr>
<tr>
<td>
Product Picture:
</td>
<td>
<input name="productPicture"
size="50" maxlength="50">
</td>
</tr>
<tr>
<td>
Product Category:
</td>
<td>
<input name="productCategory"
size="50" maxlength="50">
</td>
</tr>
<tr>
<td>
Product Brief Desc:
</td>
<td>
<textarea name="productBriefDesc"
cols="50" rows="2" wrap="virtual"></textarea>
</td>
</tr>
<tr>
<td>
Product Full Desc:
</td>
<td>
<textarea name="productFullDesc"
cols="50" rows="10" wrap="virtual"></textarea>
</td>
</tr>
<tr>
<td>
Product Status:
</td>
<td>
<select name="productStatus">
<option value="0">INACTIVE
<option value="1">ACTIVE
</select>
</td>
</tr>
<tr>
<td colspan=2 align="right">
<input type="submit" value="Add Product">
</td>
</tr>
</table>
</center>
<input name="addProduct" type="1"
value="1">
</form>
</body>
</html>
-------------------------------------------------------
e poi manageproduct.asp con questo codice:
FUNCTION fixQuotes( theString )
fixQuotes = replace( theString, "'", "''" )
END FUNCTION
<%
'Rileva le variabili del form
addProduct = TRIM( Request( "addProduct" ))
productName = TRIM( Request("productName" ))
productPrice = TRIM( Request("productPrice" ))
productPicture = TRIM( Request("productPicture" ))
productCategory = TRIM( Request("productCategory" ))
productBriefDesc = TRIM( Request("productBriefDesc" ))
productFullDesc = TRIM( Request("productFullDesc" ))
productStatus = TRIM( Request("productStatus" ))
'Assegna i valori predefiniti
IF productName = "" THEN
productName = "?????"
END IF
IF productPrice = "" THEN
productPrice = 0
END IF
IF productPicture = "" THEN
productPicture = "?????"
END IF
IF productCategory = "" THEN
productCategory = "?????"
END IF
IF productBriefDesc = "" THEN
productBriefDesc = "?????"
END IF
IF productFullDesc = "" THEN
productFullDesc = "?????"
END IF
'Apre la connessione al database
Set Con = Server.CreateObject("ADODB.Connection")
Con.Open "accessDSN"
%>
<html>
<head><title>Manage Products</title></head>
<body bgcolor="gray">
<%
'Aggiungi il nuovo prodotto
IF addProduct <> "" THEN
sqlString = "INSERT INTO Products " &_
"( product_name, product_price, product_picture, " &_
"product_category, product_briefdesc, productfulldesc, " &_
"product_status ) VALUES ( " &_
" '" & fixQuotes( productName )& "', " &_
productPrice & ", " &_
" '" & fixQuote( producyPicture ) & "', " &_
" '" & fixQuote( productCategory )& "', " &_
" '" & fixQuote( productBriefDesc ) & "', " &_
" '" & fixQuote( productFullDesc ) & "', " &_
productStatus & " )"
Con.Execute sqlString
%>
<center>
<table width="600" cellpadding="4"
cellspacing="0" bgcolor="lightyellow">
<tr>
<td>
<%=productName%> was added to the database
</td>
</tr>
</table>
</center>
<%
END IF
%>
Add Product
</body>
</html>
---------------------------------
Una volta compilato tutti i moduli, e cliccando su add product, mi da quest'errore:
Tipo di errore:
Microsoft OLE DB Provider for ODBC Drivers(0x80004005)
[Microsoft][Driver Manager ODBC] Funzione
SQLSetConnectAttr del driver non riuscita.
/negozio/manageproducts.asp, line 38
-----------------------------------------
Ho provato a mettere MDAC, ma mi da problemi di incompatibilita' di sistema. Mi sapete dire dove posso scaricare la versione nuova per windows xp service pack2? grazie in anticipo


Rispondi quotando
