我有一份写好的asp样板程序,在朋友家里的电脑还可以使用,但是拿回来到自己的电脑就出问题了:
<html>
<body>
<%
Dim strConnString
strConnString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("ProdDB.mdb") & ";"
ProdName = Request.Form("PName")
ProdQty = Request.Form("Qty")
IntQty = Cint(ProdQty) //convert string to integer
set conn=Server.CreateObject("ADODB.Connection") //open connection to database
conn.Open strConnString
sql="INSERT INTO ProdDB(Product_Name, Order_Qty) Values"
sql= sql & "('" & ProdName & "'," & IntQty & ");" //SQL statement to add record
on error resume next
conn.Execute sql, recaffected
if err<>0 then
Response.Write("Errors encountered in Inserting record!")
else
Response.Write("<h3>" & recaffected & " record added</h3>")
end if
conn.close
%>
</body>
</html>
内容很简单,就是把form上的两个变量提取,然后写入同文件夹中的Access database
database的名称,表的名称,域的名称,我都没有动。我怀疑是不是主机设置的问题。
很急呀!请大家来帮帮忙!