I have a SQL query in my ASP code to delete all records from Ms access databse where date=today. what happens is I do not see the records on my webpage, but they do no get deleted from the database. And next day, I see those records back on the page. Here is my code: <% Dim Conn Dim rs Dim sql Set Conn = Server.CreateObject("ADODB.Connection") Conn.Provider = "Microsoft.Jet.OLEDB.4.0" Conn.ConnectionString = "Data Source=" & Server.MapPath ("db.mdb") Conn.Open Set rs = Server.CreateObject("ADODB.Recordset") sql = "SELECT record.* FROM record WHERE date=Date();" Rs.Open sql, Conn, 1,3 Do while not rs.EOF rs.delete rs.MoveNext Loop rs.close %> Code (markup): How can I get the records to be deleted permanently from the database?
Have you tried Conn.execute "DELETE record WHERE date=" + Date() ?? It should work. Make sure that your string concatnation is proper.
Mayur..I am not much of a coder..can you please give me a code for what you are trying to say..thanks camjohnson95..I added rs.update but it did not work. no record gets deleted from the database.
<% Set rs = Server.CreateObject("ADODB.Recordset") 'sql = "delete FROM record WHERE date=Date();" sql = "delete FROM record WHERE date="&Date&";" ' or use '#"&date&"#' if field type is date rs.open sql,conn,1,3 rs.update rs.close %>