Skickar med koden Du missade att omge Kvalitets värdet med ' och '. Därför tolkade databasmotorn det som ett argument och ingen text.Får inte update att funka, Kan inta hitta var felet ligger, tacksam fö
ELSEIF Actionvar="update" THEN
IF Len(TRIM(Request.Form("flag"))) = 0 THEN
SQLstmt = "SELECT * FROM (tFilmTitel) WHERE ID=" & Request.QueryString("Recid")
%>
<HR>
SQL statement: <%=SQLstmt%>
<HR>
<%
Set rs = conn.Execute(SQLstmt)
IF NOT RS.EOF THEN
%>
Update<HR>
<FORM METHOD="post" ACTION="moddata.asp?Actionvar=update">
<B>Title:</B> <INPUT TYPE="text" NAME="Titel" VALUE="<%=rs("Titel")%>"><BR>
<B>Quantity:</B> <INPUT TYPE="text" NAME="Antal" VALUE="<%=rs("Antal")%>"><BR>
<B>Sort:</B> <INPUT TYPE="text" NAME="Format" VALUE="<%=rs("Format")%>"><BR>
<B>Quality:</B> <INPUT TYPE="text" NAME="Kvalite" VALUE="<%=rs("Kvalite")%>"><BR>
<INPUT TYPE="hidden" NAME="flag" VALUE="2">
<INPUT TYPE="hidden" NAME="Recordid" VALUE="<%=rs("ID")%>">
<INPUT TYPE="submit" VALUE="Update">
</FORM>
<%
rs.MoveNext
rs.Close
END IF
ELSEIF Request.Form("flag")="2" THEN
SQLstmt = "UPDATE tFilmTitel SET "
SQLstmt = SQLstmt & "Titel='" & TRIM(Request.Form("Titel")) & "', "
SQLstmt = SQLstmt & "Antal='" & TRIM(Request.Form("Antal")) & "', "
SQLstmt = SQLstmt & "Format='" & TRIM(Request.Form("Format")) & "', "
SQLstmt = SQLstmt & "Kvalite=" & TRIM(Request.Form("Kvalite"))
SQLstmt = SQLstmt & " WHERE ID=" & TRIM(Request.Form("Recordid"))
%>
<HR>
SQL statement: <%=SQLstmt%>
<HR>
<%
//LINE85// Conn.Execute(SQLstmt)
Response.Write "Operation Complete<br>Home"
END IF
här är felmeddelandet
Feltyp:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][Drivrutin för ODBC Microsoft Access] För få parametrar angavs. 1 förväntades.
/moddata.asp, line 85
Webbläsare:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Sida:
POST 66 bytes to /moddata.asp
POST Data:
Titel=Abc+fun&Antal=3&Format=vcd&Kvalite=Abc+fun&flag=2&Recordid=3 Sv: Får inte update att funka, Kan inta hitta var felet ligger, tacksam f
<code>
ELSEIF Actionvar="update" THEN
IF Len(TRIM(Request.Form("flag"))) = 0 THEN
SQLstmt = "SELECT * FROM (tFilmTitel) WHERE ID=" & Request.QueryString("Recid")
%>
<HR>
SQL statement: <%=SQLstmt%>
<HR>
<%
Set rs = conn.Execute(SQLstmt)
IF NOT RS.EOF THEN
%>
Update<HR>
<FORM METHOD="post" ACTION="moddata.asp?Actionvar=update">
<B>Title:</B> <INPUT TYPE="text" NAME="Titel" VALUE="<%=rs("Titel")%>"><BR>
<B>Quantity:</B> <INPUT TYPE="text" NAME="Antal" VALUE="<%=rs("Antal")%>"><BR>
<B>Sort:</B> <INPUT TYPE="text" NAME="Format" VALUE="<%=rs("Format")%>"><BR>
<B>Quality:</B> <INPUT TYPE="text" NAME="Kvalite" VALUE="<%=rs("Kvalite")%>"><BR>
<INPUT TYPE="hidden" NAME="flag" VALUE="2">
<INPUT TYPE="hidden" NAME="Recordid" VALUE="<%=rs("ID")%>">
<INPUT TYPE="submit" VALUE="Update">
</FORM>
<%
rs.MoveNext
rs.Close
END IF
ELSEIF Request.Form("flag")="2" THEN
SQLstmt = "UPDATE tFilmTitel SET Titel=" & SQLText(Request.Form("Titel")) & ", " & _
"Antal=" & SQLText(Request.Form("Antal")) & ", " & _
"Format=" & SQLText(Request.Form("Format")) & ", " & _
"Kvalite=" & SQLText(Request.Form("Kvalite")) & vbCrLf & _
"WHERE ID=" & TRIM(Request.Form("Recordid"))
%>
<HR>
SQL statement: <%=SQLstmt%>
<HR>
<%
//LINE85// Conn.Execute(SQLstmt)
Response.Write "Operation Complete<br>Home"
END IF
Function SQLText(Value)
Dim sTemp
sTemp = Trim(Value)
If Len(sTemp) > 0 Then
SQLText = "'" & Replace(sTemp) & "'"
Else
SQLText = "Null"
End If
End Function
</code>