Hi all,
I have a page, that displays all the records and then has a modify or delete button. When they click modify, this page comes up.
<%@ LANGUAGE="VBSCRIPT" %>
<!--#include virtual="/includes/singlequotes.asp"-->
<%
data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("form.mdb")
' Creating Recordset Object and opening the database
sql = "SELECT * FROM users"
sql = sql & " WHERE id=" & Request("id")
Set rsForm = Server.CreateObject("ADODB.Recordset")
rsForm.Open sql, data_source
If Request("action") = "Update" then
vPSQL = "Select * From users Where id = " & Request("id")
Set rsForm = Server.CreateObject("ADODB.Recordset")
rsForm.Open vPSQL, data_source
vSQL = "Update Event Details"
vSQL = vSQL & " Country = '" & FormatSingleQuotes(Request("country")) & "',"
vSQL = vSQL & " State = '" & FormatSingleQuotes(Request("state")) & "',"
vSQL = vSQL & " Details = '" & FormatSingleQuotes(Request("details")) & "',"
vSQL = vSQL & " Event Date = '" & FormatSingleQuotes(Request("eventdate")) & "',"
vSQL = vSQL & " Event Time = '" & FormatSingleQuotes(Request("eventtime")) & "',"
vSQL = vSQL & " Website = '" & FormatSingleQuotes(Request("website")) & "',"
vSQL = vSQL & " Name = '" & FormatSingleQuotes(Request("name")) & "',"
vSQL = vSQL & " Phone = '" & FormatSingleQuotes(Request("phone")) & "',"
vSQL = vSQL & " Email = '" & FormatSingleQuotes(Request("email")) & "'"
vSQL = vSQL & " Where ID = " & Request("id")
data_source.Execute(vSQL)
Response.Redirect "showall.asp"
End If
%>
<html><head><title>Update Record</title>
</head>
<body>
<form method="POST" id="eventupdate">
<input type="hidden" name="id" value="<%= Request("id") %>">
Update a record:
<table width="300" border="0" cellspacing="3" cellpadding="0">
<tr>
<td colspan="2"><strong>Main Details </strong></td>
</tr>
<tr>
<td>Country :</td>
<td><select name="country" size="1">
<%
IF rsForm("Country") <> "" then
Response.write "<option selected>" & rsform("Country") & "</option>"
ELSE
response.write "<option selected>Select country</option>"
End IF
%>
<option>Australia</option>
<option>Austria</option>
<option>Barbados</option>
</select></td>
</tr>
<tr>
<td>State :</td>
<td><input type="text" name="state" value="<%= Server.HTMLEncode(rsForm("state")) %>" /></td>
</tr>
<tr>
<td>Details :</td>
<td><textarea name="details" cols="20" rows="5" ><%= rsForm("details") %></textarea></td>
</tr>
<tr>
<td>Date :</td>
<td><input type="text" name="eventdate" value="<%= rsForm("eventdate") %>" /></td>
</tr>
<tr>
<td>Time : </td>
<td><input type="text" name="eventtime" value="<%= rsForm("eventtime") %>" /></td>
</tr>
<tr>
<td>Website:</td>
<td><input type="text" name="website" value="<%= rsForm("website") %>" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><strong>Contact Details </strong></td>
</tr>
<tr>
<td>Name:</td>
<td><input type="text" name="name" value="<%= rsForm("name") %>" /></td>
</tr>
<tr>
<td>Phone:</td>
<td><input type="text" name="phone" value="<%= rsForm("phone") %>" /></td>
</tr>
<tr>
<td>Email:</td>
<td><input type="text" name="email" value="<%= rsForm("email") %>" /></td>
</tr>
</table>
<br>
<input type="submit" value="Update" name="action">
</form>
The page displays all the information correctly, but when i click submit, it comes up with
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: ‘data_source’
/asp/update.asp, line 31
Why is this…sorry if its a n00bie question, I only learnt ASP today:-/
Thanks!