tgilbreath
Programmer
Hi guys-
Not sure what's going on here...I've got a dropdown box populated from a DB...I have all this code that is supposed to update the record. But it keeps giving me :
--------------------------------------------
Microsoft VBScript runtime error '800a000d'
Type mismatch
/admin/resource_update.asp, line 49
--------------------------------------------
The DSN is correct, because the connection is being made...but here is the line it's talking about: (49):
<input type="hidden" name="id" value="<%=RS("ID"%>">
Here is the code for the page "resource_update.asp":
<%@Language=VBScript%>
<%Response.Buffer=True%>
<html>
<body>
<%
Dim MyConn, SQL, RS, id, Items
Set MyConn=Server.CreateObject("ADODB.Connection"
MyConn.Open "DSN=ticktock-resources"
SQLStmt = "SELECT * "
SQLStmt = SQLStmt & "FROM Items "
Set RS = MyConn.Execute(SQLStmt )
%>
<form action="resource_update.asp" method="Post">
<select name="ID">
<%While Not RS.EOF%>
<option value="<%=RS("ID"%>">
<%=RS.Fields("Items"%>
<%
RS.MoveNext
Wend
RS.Close
MyConn.Close
Set RS = Nothing
Set MyConn = Nothing
%>
<input type="submit" value="Select">
</select>
</form>
<%
id = Request("ID"
If id <> "" Then
Set MyConn=Server.CreateObject("ADODB.Connection"
MyConn.Open "DSN=ticktock-resources"
%>
<form action="resource_update2.asp" method="Post">
<input type="hidden" name="id" value="<%=RS("ID"%>">
Items<input type="text" name="item" size="20" value="<%=RS("Items"%>"><br>
<input type="submit" value="Update">
<%
RS.Close
MyConn.Close
Set RS = Nothing
Set MyConn = Nothing
Else
Response.Write "<p>Please Select a Record"
End If
%>
</body>
</html>
Now here is the code for the page that actually does the work, resource_update2.asp:
<%@Language=VBScript%>
<%Response.Buffer=TRUE%>
<html>
<body>
<%
item = Replace(Request.Form("Items", "'", "''"
id = CStr(Request.Form("ID")
Set MyConn=Server.CreateObject("ADODB.Connection"
MyConn.Open "DSN=ticktock-resources"
SQL="Update tblItems Set Items = '"&items&"'' Where [ID] = "&id&""
Set RS = MyConn.Execute(SQLStmt )
MyConn.Execute(SQL)
MyConn.Close
Set MyConn = Nothing
Response.Redirect "resource_update.asp"
%>
</body>
</html>
Any help would be appreciated!!!
Tim
Not sure what's going on here...I've got a dropdown box populated from a DB...I have all this code that is supposed to update the record. But it keeps giving me :
--------------------------------------------
Microsoft VBScript runtime error '800a000d'
Type mismatch
/admin/resource_update.asp, line 49
--------------------------------------------
The DSN is correct, because the connection is being made...but here is the line it's talking about: (49):
<input type="hidden" name="id" value="<%=RS("ID"%>">
Here is the code for the page "resource_update.asp":
<%@Language=VBScript%>
<%Response.Buffer=True%>
<html>
<body>
<%
Dim MyConn, SQL, RS, id, Items
Set MyConn=Server.CreateObject("ADODB.Connection"
MyConn.Open "DSN=ticktock-resources"
SQLStmt = "SELECT * "
SQLStmt = SQLStmt & "FROM Items "
Set RS = MyConn.Execute(SQLStmt )
%>
<form action="resource_update.asp" method="Post">
<select name="ID">
<%While Not RS.EOF%>
<option value="<%=RS("ID"%>">
<%=RS.Fields("Items"%>
<%
RS.MoveNext
Wend
RS.Close
MyConn.Close
Set RS = Nothing
Set MyConn = Nothing
%>
<input type="submit" value="Select">
</select>
</form>
<%
id = Request("ID"
If id <> "" Then
Set MyConn=Server.CreateObject("ADODB.Connection"
MyConn.Open "DSN=ticktock-resources"
%>
<form action="resource_update2.asp" method="Post">
<input type="hidden" name="id" value="<%=RS("ID"%>">
Items<input type="text" name="item" size="20" value="<%=RS("Items"%>"><br>
<input type="submit" value="Update">
<%
RS.Close
MyConn.Close
Set RS = Nothing
Set MyConn = Nothing
Else
Response.Write "<p>Please Select a Record"
End If
%>
</body>
</html>
Now here is the code for the page that actually does the work, resource_update2.asp:
<%@Language=VBScript%>
<%Response.Buffer=TRUE%>
<html>
<body>
<%
item = Replace(Request.Form("Items", "'", "''"
id = CStr(Request.Form("ID")
Set MyConn=Server.CreateObject("ADODB.Connection"
MyConn.Open "DSN=ticktock-resources"
SQL="Update tblItems Set Items = '"&items&"'' Where [ID] = "&id&""
Set RS = MyConn.Execute(SQLStmt )
MyConn.Execute(SQL)
MyConn.Close
Set MyConn = Nothing
Response.Redirect "resource_update.asp"
%>
</body>
</html>
Any help would be appreciated!!!
Tim