| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
The lovely DeleteRow
The table in this screenshot is created using ASP and the information comes from a database.
When you delete the information from the database program, it doesn't delete the row with it, so a blank row sits there (with the date and venue) The two blank rows (including date and venue) need to be deleted, how do I do it? I have a single file that creates the page, its called events.asp, I don't think I need to post any code because this is pretty straight forward. This is what I have tried: Code:
<% if objrs("date") = "May 31, 2005" then object.deleteRow%><% end If %>
Basically what I thought I could do is delete rows that contain the date "May 31, 2005", but I realised later I can't do that because other events have the same date and they would end up being deleted. Any other suggestions? |
|
#2
|
||||
|
||||
|
Why not just use a simple sql delete statement with where parameters to filter the records to be deleted?
Code:
sql = "delete * from tablename where datefield=#somedate# AND sometextfield='sometextvalue' AND someintegerfield=someintegervalue"
__________________
-
thought-after | my thoughts on web development Get Firefox, the developers browser Budget hosting - recommended [/left] |
|
#3
|
|||
|
|||
|
But wouldn't the table have to be written in SQL aswell?
The table has no name, so I can't assign this sql code to the table. You got to remember that this table is generated using ASP |
|
#4
|
||||
|
||||
|
What? How does the table on the screen get generated? I would assume by parsing the results of a sql select query?
Maybe a bit more information on what you are trying to achieve might help. |
|
#5
|
|||
|
|||
|
ok I think you're right
sorry, I'm still new to this Code:
yr = request("yr")
set objrs=server.createobject("ADODB.Recordset")
sqlstmt = "select * from events where year(first_day) = '" & yr & "' order by first_day"
objdc.CommandText = sqlstmt
objrs.Open objdc, , 3, 1
|
|
#6
|
|||
|
|||
|
This is interesting, the code you suggested to me works in Firefox
but not IE 6.0 why is this? |
|
#7
|
||||
|
||||
|
Nothing to do with the browser. Must be something else in your code that is causing the problem.
|
|
#8
|
|||
|
|||
|
yeah you are right, I deleted the sql code you gave me, and firefox still makes sure those rows don't show up
strange that IE6 will make them show wonder how I can fix that |
|
#9
|
||||
|
||||
|
this is called cache issue... set expire date for the page and prevent its caching in the browser.
|
|
#10
|
|||
|
|||
|
Are you sure?
I cleared out my cache I checked on others computers I'll give it a try anyway |
|
#11
|
||||
|
||||
|
try having such code in your page:
Code:
Response.Expires = 0 Response.Expiresabsolute = Now() - 1 Response.AddHeader "pragma","no-cache" Response.AddHeader "cache-control","private" Response.CacheControl = "no-cache" this would tell the browser to avoid caching the page, most browsers would listen to this. |
|
#12
|
|||
|
|||
|
Ok does not work
riddle me this then If your table is generated using SQL and the information is stored on a database how do you know what the name of the table is? If I knew the answer to this, would I not finally be able to put in the code: sql = "delete * from tablename where event_name=''" (the '' meaning that one of the cells in the event_name column is empty) |
|
#13
|
||||
|
||||
|
according to this post of yours:
http://forums.aspfree.com/showpost....893&postcount=5 the table name is "events". |
|
#14
|
|||
|
|||
|
ahh, thanks, is that how it is with sql??, seems a lot of it is made up of words, so it would be easy to miss something
|