FP2003 - DRW Custom SQL - Delete Record

G

Grahame

Hi

I'm trying to delete records in an Access DB. I've added a DRW region on
page1 that lists all the records in the DB. I've created a <a> link that
incorporates the record ID as a querystring, and this links to page 2. On
page 2 I have a DRW with the following custom SQL

DELETE newsID FROM tblNews WHERE (newsID = '::newsID::')

I've tried various different versions of the above SQL, and the only thing
I've managed so far is to delete ALL the records at one time, not the
individual deletion I'm trying to achieve.

I've coded all this before in ASP but I'm trying to create a standalone site
for a friend, and I want to use the DRW as much as possible to save me
getting into custom coding.

Any help greatly appreciated.

Cheers

Grahame
 
T

Thomas A. Rowe

Delete.asp?newsID=1

Try changing your SQL to:

NewsID = Request.QueryString("newsID")

DELETE * FROM tblNews WHERE newsID = '::newsID::'


--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
R

Ronx

DELETE * FROM tblNews WHERE (newsID=::newsID::)

may be better, if the database field newsID is numeric. But check
that the value of newsID submitted from the form is not null, and is
numeric.
 
S

Stefan B Rusynko

Or if you don't a field type and want to prevent errors (for empty parameters) write safer ASP code

NewsID = Request.QueryString("newsID")
If IsNumeric(NewsID) And Len(NewsID)>0 Then
DELETE * FROM tblNews WHERE (newsID=::newsID::)
Else
DELETE * FROM tblNews WHERE newsID = '::newsID::'
End If
--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| DELETE * FROM tblNews WHERE (newsID=::newsID::)
|
| may be better, if the database field newsID is numeric. But check
| that the value of newsID submitted from the form is not null, and is
| numeric.
| --
| Ron Symonds - Microsoft MVP (FrontPage)
| Reply only to group - emails will be deleted unread.
| FrontPage Support: http://www.frontpagemvps.com/
|
| | > Delete.asp?newsID=1
| >
| > Try changing your SQL to:
| >
| > NewsID = Request.QueryString("newsID")
| >
| > DELETE * FROM tblNews WHERE newsID = '::newsID::'
| >
| >
| > --
| > ==============================================
| > Thomas A. Rowe (Microsoft MVP - FrontPage)
| > ==============================================
| > If you feel your current issue is a results of installing
| > a Service Pack or security update, please contact
| > Microsoft Product Support Services:
| > http://support.microsoft.com
| > If the problem can be shown to have been caused by a
| > security update, then there is usually no charge for the call.
| > ==============================================
| >
| > | >> Hi
| >>
| >> I'm trying to delete records in an Access DB. I've added a DRW
| >> region on
| >> page1 that lists all the records in the DB. I've created a <a>
| >> link that
| >> incorporates the record ID as a querystring, and this links to page
| >> 2. On
| >> page 2 I have a DRW with the following custom SQL
| >>
| >> DELETE newsID FROM tblNews WHERE (newsID = '::newsID::')
| >>
| >> I've tried various different versions of the above SQL, and the
| >> only thing
| >> I've managed so far is to delete ALL the records at one time, not
| >> the
| >> individual deletion I'm trying to achieve.
| >>
| >> I've coded all this before in ASP but I'm trying to create a
| >> standalone site
| >> for a friend, and I want to use the DRW as much as possible to save
| >> me
| >> getting into custom coding.
| >>
| >> Any help greatly appreciated.
| >>
| >> Cheers
| >>
| >> Grahame
| >>
| >>
| >>
| >
| >
|
|
 
G

Grahame

Thanks for all your advice, I'm afraid it's still not working. I seem to
remember that the FP DRW is a little choosy about how the SQL is written.
I've tried all of your DRW specific suggestions, but I'm currently trying to
avoind hard-coding this is pure ASP.

My FORM code is as follows.

<form method="POST" action="news_delete_confirm.asp">
<input type="hidden" name="newsID" value="<%=FP_FieldVal(fp_rs,"newsID")%>">
<input type="submit" value="Delete" class="smaller">
</form>


The DRW code on the news_delete_confirm.asp page looks like this...bless!

<!--webbot bot="DatabaseRegionStart" s-columnnames s-columntypes
s-dataconnection="cobpb_news" b-tableformat="TRUE" b-menuformat="FALSE"
s-menuchoice s-menuvalue b-tableborder="FALSE" b-tableexpand="FALSE"
b-tableheader="FALSE" b-listlabels="TRUE" b-listseparator="TRUE"
i-listformat="0" b-makeform="FALSE" s-recordsource s-displaycolumns
s-criteria s-order s-sql="DELETE * FROM tblNews WHERE (newsID =::newsID::)"
b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="newsID="
s-norecordsfound="All OK" i-maxrecords="0" i-groupsize="0" botid="0"
u-dblib="../_fpclass/fpdblib.inc" u-dbrgn1="../_fpclass/fpdbrgn1.inc"
u-dbrgn2="../_fpclass/fpdbrgn2.inc" tag="TBODY" preview="&lt;tr&gt;&lt;td
colspan=64 bgcolor=&quot;#FFFF00&quot; width=&quot;100%&quot;&gt;&lt;font
color=&quot;#000000&quot;&gt;This is the start of a Database Results region.
The page must be fetched from a web server with a web browser to display
correctly; the current web is stored on your local disk or
network.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" b-UseDotNET="FALSE" CurrentExt
sa-InputTypes b-DataGridFormat="FALSE" b-DGridAlternate="TRUE" sa-CritTypes
b-WasTableFormat="TRUE" startspan --><!--#include
file="../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database
Results component on this page is unable to display database content. The
page must have a filename ending in '.asp', and the web must be hosted on a
server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="DELETE * FROM tblNews WHERE (newsID =::newsID::)"
fp_sDefault="newsID="
fp_sNoRecords="<tr><td colspan=16 align=""LEFT""
width=""100%"">Deleted</td></tr>"
fp_sDataConn="cobpb_news"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&"
fp_iDisplayCols=16
fp_fCustomQuery=True
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan
i-checksum="44852" --><!--webbot bot="DatabaseRegionEnd"
b-tableformat="TRUE" b-menuformat="FALSE"
u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="TBODY"
preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot;
width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the
end of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;"
startspan --><!--#include file="../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" -->



Do you guys have any other suggestions? I think the problem lies in my SQL
statement, and I've tried various different ways of writing it, with and
without parentheses, with and without apostrophes or colons....it's driving
me mad!

cheers

Grahame




Stefan B Rusynko said:
Or if you don't a field type and want to prevent errors (for empty
parameters) write safer ASP code

NewsID = Request.QueryString("newsID")
If IsNumeric(NewsID) And Len(NewsID)>0 Then
DELETE * FROM tblNews WHERE (newsID=::newsID::)
Else
DELETE * FROM tblNews WHERE newsID = '::newsID::'
End If
--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| DELETE * FROM tblNews WHERE (newsID=::newsID::)
|
| may be better, if the database field newsID is numeric. But check
| that the value of newsID submitted from the form is not null, and is
| numeric.
| --
| Ron Symonds - Microsoft MVP (FrontPage)
| Reply only to group - emails will be deleted unread.
| FrontPage Support: http://www.frontpagemvps.com/
|
| | > Delete.asp?newsID=1
| >
| > Try changing your SQL to:
| >
| > NewsID = Request.QueryString("newsID")
| >
| > DELETE * FROM tblNews WHERE newsID = '::newsID::'
| >
| >
| > --
| > ==============================================
| > Thomas A. Rowe (Microsoft MVP - FrontPage)
| > ==============================================
| > If you feel your current issue is a results of installing
| > a Service Pack or security update, please contact
| > Microsoft Product Support Services:
| > http://support.microsoft.com
| > If the problem can be shown to have been caused by a
| > security update, then there is usually no charge for the call.
| > ==============================================
| >
| > | >> Hi
| >>
| >> I'm trying to delete records in an Access DB. I've added a DRW
| >> region on
| >> page1 that lists all the records in the DB. I've created a <a>
| >> link that
| >> incorporates the record ID as a querystring, and this links to page
| >> 2. On
| >> page 2 I have a DRW with the following custom SQL
| >>
| >> DELETE newsID FROM tblNews WHERE (newsID = '::newsID::')
| >>
| >> I've tried various different versions of the above SQL, and the
| >> only thing
| >> I've managed so far is to delete ALL the records at one time, not
| >> the
| >> individual deletion I'm trying to achieve.
| >>
| >> I've coded all this before in ASP but I'm trying to create a
| >> standalone site
| >> for a friend, and I want to use the DRW as much as possible to save
| >> me
| >> getting into custom coding.
| >>
| >> Any help greatly appreciated.
| >>
| >> Cheers
| >>
| >> Grahame
| >>
| >>
| >>
| >
| >
|
|
 
G

Grahame

Hi Again

Sorry, I should have said that I've now moved from a using an <a> link with
querystring to using a <form> with POST to pass the newsID value to the
deletion page. I've been playing with the pages a little just to try to get
it working...

The newsID field is an Access Autonumber field, so it's numeric and never
null.

Cheers



Grahame said:
Thanks for all your advice, I'm afraid it's still not working. I seem to
remember that the FP DRW is a little choosy about how the SQL is written.
I've tried all of your DRW specific suggestions, but I'm currently trying
to avoind hard-coding this is pure ASP.

My FORM code is as follows.

<form method="POST" action="news_delete_confirm.asp">
<input type="hidden" name="newsID"
value="<%=FP_FieldVal(fp_rs,"newsID")%>">
<input type="submit" value="Delete" class="smaller">
</form>


The DRW code on the news_delete_confirm.asp page looks like this...bless!

<!--webbot bot="DatabaseRegionStart" s-columnnames s-columntypes
s-dataconnection="cobpb_news" b-tableformat="TRUE" b-menuformat="FALSE"
s-menuchoice s-menuvalue b-tableborder="FALSE" b-tableexpand="FALSE"
b-tableheader="FALSE" b-listlabels="TRUE" b-listseparator="TRUE"
i-listformat="0" b-makeform="FALSE" s-recordsource s-displaycolumns
s-criteria s-order s-sql="DELETE * FROM tblNews WHERE (newsID
=::newsID::)" b-procedure="FALSE" clientside suggestedext="asp"
s-defaultfields="newsID=" s-norecordsfound="All OK" i-maxrecords="0"
i-groupsize="0" botid="0" u-dblib="../_fpclass/fpdblib.inc"
u-dbrgn1="../_fpclass/fpdbrgn1.inc" u-dbrgn2="../_fpclass/fpdbrgn2.inc"
tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64
bgcolor=&quot;#FFFF00&quot; width=&quot;100%&quot;&gt;&lt;font
color=&quot;#000000&quot;&gt;This is the start of a Database Results
region. The page must be fetched from a web server with a web browser to
display correctly; the current web is stored on your local disk or
network.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" b-UseDotNET="FALSE"
CurrentExt sa-InputTypes b-DataGridFormat="FALSE" b-DGridAlternate="TRUE"
sa-CritTypes b-WasTableFormat="TRUE" startspan --><!--#include
file="../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The
Database Results component on this page is unable to display database
content. The page must have a filename ending in '.asp', and the web must
be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="DELETE * FROM tblNews WHERE (newsID =::newsID::)"
fp_sDefault="newsID="
fp_sNoRecords="<tr><td colspan=16 align=""LEFT""
width=""100%"">Deleted</td></tr>"
fp_sDataConn="cobpb_news"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&"
fp_iDisplayCols=16
fp_fCustomQuery=True
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan
i-checksum="44852" --><!--webbot bot="DatabaseRegionEnd"
b-tableformat="TRUE" b-menuformat="FALSE"
u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="TBODY"
preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot;
width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is
the end of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;"
startspan --><!--#include file="../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" -->



Do you guys have any other suggestions? I think the problem lies in my
SQL statement, and I've tried various different ways of writing it, with
and without parentheses, with and without apostrophes or colons....it's
driving me mad!

cheers

Grahame




Stefan B Rusynko said:
Or if you don't a field type and want to prevent errors (for empty
parameters) write safer ASP code

NewsID = Request.QueryString("newsID")
If IsNumeric(NewsID) And Len(NewsID)>0 Then
DELETE * FROM tblNews WHERE (newsID=::newsID::)
Else
DELETE * FROM tblNews WHERE newsID = '::newsID::'
End If
--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| DELETE * FROM tblNews WHERE (newsID=::newsID::)
|
| may be better, if the database field newsID is numeric. But check
| that the value of newsID submitted from the form is not null, and is
| numeric.
| --
| Ron Symonds - Microsoft MVP (FrontPage)
| Reply only to group - emails will be deleted unread.
| FrontPage Support: http://www.frontpagemvps.com/
|
| | > Delete.asp?newsID=1
| >
| > Try changing your SQL to:
| >
| > NewsID = Request.QueryString("newsID")
| >
| > DELETE * FROM tblNews WHERE newsID = '::newsID::'
| >
| >
| > --
| > ==============================================
| > Thomas A. Rowe (Microsoft MVP - FrontPage)
| > ==============================================
| > If you feel your current issue is a results of installing
| > a Service Pack or security update, please contact
| > Microsoft Product Support Services:
| > http://support.microsoft.com
| > If the problem can be shown to have been caused by a
| > security update, then there is usually no charge for the call.
| > ==============================================
| >
| > | >> Hi
| >>
| >> I'm trying to delete records in an Access DB. I've added a DRW
| >> region on
| >> page1 that lists all the records in the DB. I've created a <a>
| >> link that
| >> incorporates the record ID as a querystring, and this links to page
| >> 2. On
| >> page 2 I have a DRW with the following custom SQL
| >>
| >> DELETE newsID FROM tblNews WHERE (newsID = '::newsID::')
| >>
| >> I've tried various different versions of the above SQL, and the
| >> only thing
| >> I've managed so far is to delete ALL the records at one time, not
| >> the
| >> individual deletion I'm trying to achieve.
| >>
| >> I've coded all this before in ASP but I'm trying to create a
| >> standalone site
| >> for a friend, and I want to use the DRW as much as possible to save
| >> me
| >> getting into custom coding.
| >>
| >> Any help greatly appreciated.
| >>
| >> Cheers
| >>
| >> Grahame
| >>
| >>
| >>
| >
| >
|
|
 
S

Stefan B Rusynko

Not a good move using a parameter (query string)
That means anyone can delete any record by justcahnging the parameter on the confirm page
- change it back to a form w/ a hidden form field

On your confirm page add before the DRW code add
<%
newsID = Request.Form("newsID")
If IsNumeric(newsID) And Len(newsID)>0 Then
DELETE * FROM tblNews WHERE (newsID=::newsID::)
Else
DELETE * FROM tblNews WHERE newsID = '::newsID::'
End If
%>

And Delete the whole DRW



--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| Hi Again
|
| Sorry, I should have said that I've now moved from a using an <a> link with
| querystring to using a <form> with POST to pass the newsID value to the
| deletion page. I've been playing with the pages a little just to try to get
| it working...
|
| The newsID field is an Access Autonumber field, so it's numeric and never
| null.
|
| Cheers
|
|
|
| | > Thanks for all your advice, I'm afraid it's still not working. I seem to
| > remember that the FP DRW is a little choosy about how the SQL is written.
| > I've tried all of your DRW specific suggestions, but I'm currently trying
| > to avoind hard-coding this is pure ASP.
| >
| > My FORM code is as follows.
| >
| > <form method="POST" action="news_delete_confirm.asp">
| > <input type="hidden" name="newsID"
| > value="<%=FP_FieldVal(fp_rs,"newsID")%>">
| > <input type="submit" value="Delete" class="smaller">
| > </form>
| >
| >
| > The DRW code on the news_delete_confirm.asp page looks like this...bless!
| >
| > <!--webbot bot="DatabaseRegionStart" s-columnnames s-columntypes
| > s-dataconnection="cobpb_news" b-tableformat="TRUE" b-menuformat="FALSE"
| > s-menuchoice s-menuvalue b-tableborder="FALSE" b-tableexpand="FALSE"
| > b-tableheader="FALSE" b-listlabels="TRUE" b-listseparator="TRUE"
| > i-listformat="0" b-makeform="FALSE" s-recordsource s-displaycolumns
| > s-criteria s-order s-sql="DELETE * FROM tblNews WHERE (newsID
| > =::newsID::)" b-procedure="FALSE" clientside suggestedext="asp"
| > s-defaultfields="newsID=" s-norecordsfound="All OK" i-maxrecords="0"
| > i-groupsize="0" botid="0" u-dblib="../_fpclass/fpdblib.inc"
| > u-dbrgn1="../_fpclass/fpdbrgn1.inc" u-dbrgn2="../_fpclass/fpdbrgn2.inc"
| > tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64
| > bgcolor=&quot;#FFFF00&quot; width=&quot;100%&quot;&gt;&lt;font
| > color=&quot;#000000&quot;&gt;This is the start of a Database Results
| > region. The page must be fetched from a web server with a web browser to
| > display correctly; the current web is stored on your local disk or
| > network.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" b-UseDotNET="FALSE"
| > CurrentExt sa-InputTypes b-DataGridFormat="FALSE" b-DGridAlternate="TRUE"
| > sa-CritTypes b-WasTableFormat="TRUE" startspan --><!--#include
| > file="../_fpclass/fpdblib.inc"-->
| > <% if 0 then %>
| > <SCRIPT Language="JavaScript">
| > document.write("<div style='background: yellow; color: black;'>The
| > Database Results component on this page is unable to display database
| > content. The page must have a filename ending in '.asp', and the web must
| > be hosted on a server that supports Active Server Pages.</div>");
| > </SCRIPT>
| > <% end if %>
| > <%
| > fp_sQry="DELETE * FROM tblNews WHERE (newsID =::newsID::)"
| > fp_sDefault="newsID="
| > fp_sNoRecords="<tr><td colspan=16 align=""LEFT""
| > width=""100%"">Deleted</td></tr>"
| > fp_sDataConn="cobpb_news"
| > fp_iMaxRecords=0
| > fp_iCommandType=1
| > fp_iPageSize=0
| > fp_fTableFormat=True
| > fp_fMenuFormat=False
| > fp_sMenuChoice=""
| > fp_sMenuValue=""
| > fp_sColTypes="&"
| > fp_iDisplayCols=16
| > fp_fCustomQuery=True
| > BOTID=0
| > fp_iRegion=BOTID
| > %>
| > <!--#include file="../_fpclass/fpdbrgn1.inc"-->
| > <!--webbot bot="DatabaseRegionStart" endspan
| > i-checksum="44852" --><!--webbot bot="DatabaseRegionEnd"
| > b-tableformat="TRUE" b-menuformat="FALSE"
| > u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="TBODY"
| > preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot;
| > width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is
| > the end of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;"
| > startspan --><!--#include file="../_fpclass/fpdbrgn2.inc"-->
| > <!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" -->
| >
| >
| >
| > Do you guys have any other suggestions? I think the problem lies in my
| > SQL statement, and I've tried various different ways of writing it, with
| > and without parentheses, with and without apostrophes or colons....it's
| > driving me mad!
| >
| > cheers
| >
| > Grahame
| >
| >
| >
| >
| > | >> Or if you don't a field type and want to prevent errors (for empty
| >> parameters) write safer ASP code
| >>
| >> NewsID = Request.QueryString("newsID")
| >> If IsNumeric(NewsID) And Len(NewsID)>0 Then
| >> DELETE * FROM tblNews WHERE (newsID=::newsID::)
| >> Else
| >> DELETE * FROM tblNews WHERE newsID = '::newsID::'
| >> End If
| >> --
| >>
| >> _____________________________________________
| >> SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| >> "Warning - Using the F1 Key will not break anything!" (-;
| >> To find the best Newsgroup for FrontPage support see:
| >> http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
| >> _____________________________________________
| >>
| >>
| >> | >> | DELETE * FROM tblNews WHERE (newsID=::newsID::)
| >> |
| >> | may be better, if the database field newsID is numeric. But check
| >> | that the value of newsID submitted from the form is not null, and is
| >> | numeric.
| >> | --
| >> | Ron Symonds - Microsoft MVP (FrontPage)
| >> | Reply only to group - emails will be deleted unread.
| >> | FrontPage Support: http://www.frontpagemvps.com/
| >> |
| >> | | >> | > Delete.asp?newsID=1
| >> | >
| >> | > Try changing your SQL to:
| >> | >
| >> | > NewsID = Request.QueryString("newsID")
| >> | >
| >> | > DELETE * FROM tblNews WHERE newsID = '::newsID::'
| >> | >
| >> | >
| >> | > --
| >> | > ==============================================
| >> | > Thomas A. Rowe (Microsoft MVP - FrontPage)
| >> | > ==============================================
| >> | > If you feel your current issue is a results of installing
| >> | > a Service Pack or security update, please contact
| >> | > Microsoft Product Support Services:
| >> | > http://support.microsoft.com
| >> | > If the problem can be shown to have been caused by a
| >> | > security update, then there is usually no charge for the call.
| >> | > ==============================================
| >> | >
| >> | > | >> | >> Hi
| >> | >>
| >> | >> I'm trying to delete records in an Access DB. I've added a DRW
| >> | >> region on
| >> | >> page1 that lists all the records in the DB. I've created a <a>
| >> | >> link that
| >> | >> incorporates the record ID as a querystring, and this links to page
| >> | >> 2. On
| >> | >> page 2 I have a DRW with the following custom SQL
| >> | >>
| >> | >> DELETE newsID FROM tblNews WHERE (newsID = '::newsID::')
| >> | >>
| >> | >> I've tried various different versions of the above SQL, and the
| >> | >> only thing
| >> | >> I've managed so far is to delete ALL the records at one time, not
| >> | >> the
| >> | >> individual deletion I'm trying to achieve.
| >> | >>
| >> | >> I've coded all this before in ASP but I'm trying to create a
| >> | >> standalone site
| >> | >> for a friend, and I want to use the DRW as much as possible to save
| >> | >> me
| >> | >> getting into custom coding.
| >> | >>
| >> | >> Any help greatly appreciated.
| >> | >>
| >> | >> Cheers
| >> | >>
| >> | >> Grahame
| >> | >>
| >> | >>
| >> | >>
| >> | >
| >> | >
| >> |
| >> |
| >>
| >>
| >
| >
|
|
 
G

Grahame

Hi Stefan

Thanks for the tip. I'd need to open the DB connection and execute the SQL
to use that code, and that's the bit I'm trying hard to avoid. The site is
for a friend, a favour that's grown wings and gills (!), so I'm keen to make
this coding as simple as possible.

There are gong to be quote a few DBs in the web site s that it can be
updated without me having to look at it again, so I'm loathe to go down the
hard-coding route.

Cheers

Grahame


Stefan B Rusynko said:
Not a good move using a parameter (query string)
That means anyone can delete any record by justcahnging the parameter on
the confirm page
- change it back to a form w/ a hidden form field

On your confirm page add before the DRW code add
<%
newsID = Request.Form("newsID")
If IsNumeric(newsID) And Len(newsID)>0 Then
DELETE * FROM tblNews WHERE (newsID=::newsID::)
Else
DELETE * FROM tblNews WHERE newsID = '::newsID::'
End If
%>

And Delete the whole DRW



--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| Hi Again
|
| Sorry, I should have said that I've now moved from a using an <a> link
with
| querystring to using a <form> with POST to pass the newsID value to the
| deletion page. I've been playing with the pages a little just to try to
get
| it working...
|
| The newsID field is an Access Autonumber field, so it's numeric and
never
| null.
|
| Cheers
|
|
|
| | > Thanks for all your advice, I'm afraid it's still not working. I seem
to
| > remember that the FP DRW is a little choosy about how the SQL is
written.
| > I've tried all of your DRW specific suggestions, but I'm currently
trying
| > to avoind hard-coding this is pure ASP.
| >
| > My FORM code is as follows.
| >
| > <form method="POST" action="news_delete_confirm.asp">
| > <input type="hidden" name="newsID"
| > value="<%=FP_FieldVal(fp_rs,"newsID")%>">
| > <input type="submit" value="Delete" class="smaller">
| > </form>
| >
| >
| > The DRW code on the news_delete_confirm.asp page looks like
this...bless!
| >
| > <!--webbot bot="DatabaseRegionStart" s-columnnames s-columntypes
| > s-dataconnection="cobpb_news" b-tableformat="TRUE"
b-menuformat="FALSE"
| > s-menuchoice s-menuvalue b-tableborder="FALSE" b-tableexpand="FALSE"
| > b-tableheader="FALSE" b-listlabels="TRUE" b-listseparator="TRUE"
| > i-listformat="0" b-makeform="FALSE" s-recordsource s-displaycolumns
| > s-criteria s-order s-sql="DELETE * FROM tblNews WHERE (newsID
| > =::newsID::)" b-procedure="FALSE" clientside suggestedext="asp"
| > s-defaultfields="newsID=" s-norecordsfound="All OK" i-maxrecords="0"
| > i-groupsize="0" botid="0" u-dblib="../_fpclass/fpdblib.inc"
| > u-dbrgn1="../_fpclass/fpdbrgn1.inc"
u-dbrgn2="../_fpclass/fpdbrgn2.inc"
| > tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64
| > bgcolor=&quot;#FFFF00&quot; width=&quot;100%&quot;&gt;&lt;font
| > color=&quot;#000000&quot;&gt;This is the start of a Database Results
| > region. The page must be fetched from a web server with a web browser
to
| > display correctly; the current web is stored on your local disk or
| > network.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" b-UseDotNET="FALSE"
| > CurrentExt sa-InputTypes b-DataGridFormat="FALSE"
b-DGridAlternate="TRUE"
| > sa-CritTypes b-WasTableFormat="TRUE" startspan --><!--#include
| > file="../_fpclass/fpdblib.inc"-->
| > <% if 0 then %>
| > <SCRIPT Language="JavaScript">
| > document.write("<div style='background: yellow; color: black;'>The
| > Database Results component on this page is unable to display database
| > content. The page must have a filename ending in '.asp', and the web
must
| > be hosted on a server that supports Active Server Pages.</div>");
| > </SCRIPT>
| > <% end if %>
| > <%
| > fp_sQry="DELETE * FROM tblNews WHERE (newsID =::newsID::)"
| > fp_sDefault="newsID="
| > fp_sNoRecords="<tr><td colspan=16 align=""LEFT""
| > width=""100%"">Deleted</td></tr>"
| > fp_sDataConn="cobpb_news"
| > fp_iMaxRecords=0
| > fp_iCommandType=1
| > fp_iPageSize=0
| > fp_fTableFormat=True
| > fp_fMenuFormat=False
| > fp_sMenuChoice=""
| > fp_sMenuValue=""
| > fp_sColTypes="&"
| > fp_iDisplayCols=16
| > fp_fCustomQuery=True
| > BOTID=0
| > fp_iRegion=BOTID
| > %>
| > <!--#include file="../_fpclass/fpdbrgn1.inc"-->
| > <!--webbot bot="DatabaseRegionStart" endspan
| > i-checksum="44852" --><!--webbot bot="DatabaseRegionEnd"
| > b-tableformat="TRUE" b-menuformat="FALSE"
| > u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside
tag="TBODY"
| > preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot;
| > width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This
is
| > the end of a Database Results
region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;"
| > startspan --><!--#include file="../_fpclass/fpdbrgn2.inc"-->
| > <!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" -->
| >
| >
| >
| > Do you guys have any other suggestions? I think the problem lies in
my
| > SQL statement, and I've tried various different ways of writing it,
with
| > and without parentheses, with and without apostrophes or
colons....it's
| > driving me mad!
| >
| > cheers
| >
| > Grahame
| >
| >
| >
| >
| > | >> Or if you don't a field type and want to prevent errors (for empty
| >> parameters) write safer ASP code
| >>
| >> NewsID = Request.QueryString("newsID")
| >> If IsNumeric(NewsID) And Len(NewsID)>0 Then
| >> DELETE * FROM tblNews WHERE (newsID=::newsID::)
| >> Else
| >> DELETE * FROM tblNews WHERE newsID = '::newsID::'
| >> End If
| >> --
| >>
| >> _____________________________________________
| >> SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| >> "Warning - Using the F1 Key will not break anything!" (-;
| >> To find the best Newsgroup for FrontPage support see:
| >>
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
| >> _____________________________________________
| >>
| >>
| >> | >> | DELETE * FROM tblNews WHERE (newsID=::newsID::)
| >> |
| >> | may be better, if the database field newsID is numeric. But check
| >> | that the value of newsID submitted from the form is not null, and
is
| >> | numeric.
| >> | --
| >> | Ron Symonds - Microsoft MVP (FrontPage)
| >> | Reply only to group - emails will be deleted unread.
| >> | FrontPage Support: http://www.frontpagemvps.com/
| >> |
| >> | | >> | > Delete.asp?newsID=1
| >> | >
| >> | > Try changing your SQL to:
| >> | >
| >> | > NewsID = Request.QueryString("newsID")
| >> | >
| >> | > DELETE * FROM tblNews WHERE newsID = '::newsID::'
| >> | >
| >> | >
| >> | > --
| >> | > ==============================================
| >> | > Thomas A. Rowe (Microsoft MVP - FrontPage)
| >> | > ==============================================
| >> | > If you feel your current issue is a results of installing
| >> | > a Service Pack or security update, please contact
| >> | > Microsoft Product Support Services:
| >> | > http://support.microsoft.com
| >> | > If the problem can be shown to have been caused by a
| >> | > security update, then there is usually no charge for the call.
| >> | > ==============================================
| >> | >
| >> | > | >> | >> Hi
| >> | >>
| >> | >> I'm trying to delete records in an Access DB. I've added a DRW
| >> | >> region on
| >> | >> page1 that lists all the records in the DB. I've created a <a>
| >> | >> link that
| >> | >> incorporates the record ID as a querystring, and this links to
page
| >> | >> 2. On
| >> | >> page 2 I have a DRW with the following custom SQL
| >> | >>
| >> | >> DELETE newsID FROM tblNews WHERE (newsID = '::newsID::')
| >> | >>
| >> | >> I've tried various different versions of the above SQL, and the
| >> | >> only thing
| >> | >> I've managed so far is to delete ALL the records at one time,
not
| >> | >> the
| >> | >> individual deletion I'm trying to achieve.
| >> | >>
| >> | >> I've coded all this before in ASP but I'm trying to create a
| >> | >> standalone site
| >> | >> for a friend, and I want to use the DRW as much as possible to
save
| >> | >> me
| >> | >> getting into custom coding.
| >> | >>
| >> | >> Any help greatly appreciated.
| >> | >>
| >> | >> Cheers
| >> | >>
| >> | >> Grahame
| >> | >>
| >> | >>
| >> | >>
| >> | >
| >> | >
| >> |
| >> |
| >>
| >>
| >
| >
|
|
 
S

Stefan B Rusynko

Then see http://home.att.net/~codelibrary/FrontPage/drw.htm

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| Hi Stefan
|
| Thanks for the tip. I'd need to open the DB connection and execute the SQL
| to use that code, and that's the bit I'm trying hard to avoid. The site is
| for a friend, a favour that's grown wings and gills (!), so I'm keen to make
| this coding as simple as possible.
|
| There are gong to be quote a few DBs in the web site s that it can be
| updated without me having to look at it again, so I'm loathe to go down the
| hard-coding route.
|
| Cheers
|
| Grahame
|
|
| | > Not a good move using a parameter (query string)
| > That means anyone can delete any record by justcahnging the parameter on
| > the confirm page
| > - change it back to a form w/ a hidden form field
| >
| > On your confirm page add before the DRW code add
| > <%
| > newsID = Request.Form("newsID")
| > If IsNumeric(newsID) And Len(newsID)>0 Then
| > DELETE * FROM tblNews WHERE (newsID=::newsID::)
| > Else
| > DELETE * FROM tblNews WHERE newsID = '::newsID::'
| > End If
| > %>
| >
| > And Delete the whole DRW
| >
| >
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| > http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
| > _____________________________________________
| >
| >
| > | > | Hi Again
| > |
| > | Sorry, I should have said that I've now moved from a using an <a> link
| > with
| > | querystring to using a <form> with POST to pass the newsID value to the
| > | deletion page. I've been playing with the pages a little just to try to
| > get
| > | it working...
| > |
| > | The newsID field is an Access Autonumber field, so it's numeric and
| > never
| > | null.
| > |
| > | Cheers
| > |
| > |
| > |
| > | | > | > Thanks for all your advice, I'm afraid it's still not working. I seem
| > to
| > | > remember that the FP DRW is a little choosy about how the SQL is
| > written.
| > | > I've tried all of your DRW specific suggestions, but I'm currently
| > trying
| > | > to avoind hard-coding this is pure ASP.
| > | >
| > | > My FORM code is as follows.
| > | >
| > | > <form method="POST" action="news_delete_confirm.asp">
| > | > <input type="hidden" name="newsID"
| > | > value="<%=FP_FieldVal(fp_rs,"newsID")%>">
| > | > <input type="submit" value="Delete" class="smaller">
| > | > </form>
| > | >
| > | >
| > | > The DRW code on the news_delete_confirm.asp page looks like
| > this...bless!
| > | >
| > | > <!--webbot bot="DatabaseRegionStart" s-columnnames s-columntypes
| > | > s-dataconnection="cobpb_news" b-tableformat="TRUE"
| > b-menuformat="FALSE"
| > | > s-menuchoice s-menuvalue b-tableborder="FALSE" b-tableexpand="FALSE"
| > | > b-tableheader="FALSE" b-listlabels="TRUE" b-listseparator="TRUE"
| > | > i-listformat="0" b-makeform="FALSE" s-recordsource s-displaycolumns
| > | > s-criteria s-order s-sql="DELETE * FROM tblNews WHERE (newsID
| > | > =::newsID::)" b-procedure="FALSE" clientside suggestedext="asp"
| > | > s-defaultfields="newsID=" s-norecordsfound="All OK" i-maxrecords="0"
| > | > i-groupsize="0" botid="0" u-dblib="../_fpclass/fpdblib.inc"
| > | > u-dbrgn1="../_fpclass/fpdbrgn1.inc"
| > u-dbrgn2="../_fpclass/fpdbrgn2.inc"
| > | > tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64
| > | > bgcolor=&quot;#FFFF00&quot; width=&quot;100%&quot;&gt;&lt;font
| > | > color=&quot;#000000&quot;&gt;This is the start of a Database Results
| > | > region. The page must be fetched from a web server with a web browser
| > to
| > | > display correctly; the current web is stored on your local disk or
| > | > network.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" b-UseDotNET="FALSE"
| > | > CurrentExt sa-InputTypes b-DataGridFormat="FALSE"
| > b-DGridAlternate="TRUE"
| > | > sa-CritTypes b-WasTableFormat="TRUE" startspan --><!--#include
| > | > file="../_fpclass/fpdblib.inc"-->
| > | > <% if 0 then %>
| > | > <SCRIPT Language="JavaScript">
| > | > document.write("<div style='background: yellow; color: black;'>The
| > | > Database Results component on this page is unable to display database
| > | > content. The page must have a filename ending in '.asp', and the web
| > must
| > | > be hosted on a server that supports Active Server Pages.</div>");
| > | > </SCRIPT>
| > | > <% end if %>
| > | > <%
| > | > fp_sQry="DELETE * FROM tblNews WHERE (newsID =::newsID::)"
| > | > fp_sDefault="newsID="
| > | > fp_sNoRecords="<tr><td colspan=16 align=""LEFT""
| > | > width=""100%"">Deleted</td></tr>"
| > | > fp_sDataConn="cobpb_news"
| > | > fp_iMaxRecords=0
| > | > fp_iCommandType=1
| > | > fp_iPageSize=0
| > | > fp_fTableFormat=True
| > | > fp_fMenuFormat=False
| > | > fp_sMenuChoice=""
| > | > fp_sMenuValue=""
| > | > fp_sColTypes="&"
| > | > fp_iDisplayCols=16
| > | > fp_fCustomQuery=True
| > | > BOTID=0
| > | > fp_iRegion=BOTID
| > | > %>
| > | > <!--#include file="../_fpclass/fpdbrgn1.inc"-->
| > | > <!--webbot bot="DatabaseRegionStart" endspan
| > | > i-checksum="44852" --><!--webbot bot="DatabaseRegionEnd"
| > | > b-tableformat="TRUE" b-menuformat="FALSE"
| > | > u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside
| > tag="TBODY"
| > | > preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot;
| > | > width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This
| > is
| > | > the end of a Database Results
| > region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;"
| > | > startspan --><!--#include file="../_fpclass/fpdbrgn2.inc"-->
| > | > <!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" -->
| > | >
| > | >
| > | >
| > | > Do you guys have any other suggestions? I think the problem lies in
| > my
| > | > SQL statement, and I've tried various different ways of writing it,
| > with
| > | > and without parentheses, with and without apostrophes or
| > colons....it's
| > | > driving me mad!
| > | >
| > | > cheers
| > | >
| > | > Grahame
| > | >
| > | >
| > | >
| > | >
| > | > | > | >> Or if you don't a field type and want to prevent errors (for empty
| > | >> parameters) write safer ASP code
| > | >>
| > | >> NewsID = Request.QueryString("newsID")
| > | >> If IsNumeric(NewsID) And Len(NewsID)>0 Then
| > | >> DELETE * FROM tblNews WHERE (newsID=::newsID::)
| > | >> Else
| > | >> DELETE * FROM tblNews WHERE newsID = '::newsID::'
| > | >> End If
| > | >> --
| > | >>
| > | >> _____________________________________________
| > | >> SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > | >> "Warning - Using the F1 Key will not break anything!" (-;
| > | >> To find the best Newsgroup for FrontPage support see:
| > | >>
| > http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
| > | >> _____________________________________________
| > | >>
| > | >>
| > | >> | > | >> | DELETE * FROM tblNews WHERE (newsID=::newsID::)
| > | >> |
| > | >> | may be better, if the database field newsID is numeric. But check
| > | >> | that the value of newsID submitted from the form is not null, and
| > is
| > | >> | numeric.
| > | >> | --
| > | >> | Ron Symonds - Microsoft MVP (FrontPage)
| > | >> | Reply only to group - emails will be deleted unread.
| > | >> | FrontPage Support: http://www.frontpagemvps.com/
| > | >> |
| > | >> | | > | >> | > Delete.asp?newsID=1
| > | >> | >
| > | >> | > Try changing your SQL to:
| > | >> | >
| > | >> | > NewsID = Request.QueryString("newsID")
| > | >> | >
| > | >> | > DELETE * FROM tblNews WHERE newsID = '::newsID::'
| > | >> | >
| > | >> | >
| > | >> | > --
| > | >> | > ==============================================
| > | >> | > Thomas A. Rowe (Microsoft MVP - FrontPage)
| > | >> | > ==============================================
| > | >> | > If you feel your current issue is a results of installing
| > | >> | > a Service Pack or security update, please contact
| > | >> | > Microsoft Product Support Services:
| > | >> | > http://support.microsoft.com
| > | >> | > If the problem can be shown to have been caused by a
| > | >> | > security update, then there is usually no charge for the call.
| > | >> | > ==============================================
| > | >> | >
| > | >> | > | > | >> | >> Hi
| > | >> | >>
| > | >> | >> I'm trying to delete records in an Access DB. I've added a DRW
| > | >> | >> region on
| > | >> | >> page1 that lists all the records in the DB. I've created a <a>
| > | >> | >> link that
| > | >> | >> incorporates the record ID as a querystring, and this links to
| > page
| > | >> | >> 2. On
| > | >> | >> page 2 I have a DRW with the following custom SQL
| > | >> | >>
| > | >> | >> DELETE newsID FROM tblNews WHERE (newsID = '::newsID::')
| > | >> | >>
| > | >> | >> I've tried various different versions of the above SQL, and the
| > | >> | >> only thing
| > | >> | >> I've managed so far is to delete ALL the records at one time,
| > not
| > | >> | >> the
| > | >> | >> individual deletion I'm trying to achieve.
| > | >> | >>
| > | >> | >> I've coded all this before in ASP but I'm trying to create a
| > | >> | >> standalone site
| > | >> | >> for a friend, and I want to use the DRW as much as possible to
| > save
| > | >> | >> me
| > | >> | >> getting into custom coding.
| > | >> | >>
| > | >> | >> Any help greatly appreciated.
| > | >> | >>
| > | >> | >> Cheers
| > | >> | >>
| > | >> | >> Grahame
| > | >> | >>
| > | >> | >>
| > | >> | >>
| > | >> | >
| > | >> | >
| > | >> |
| > | >> |
| > | >>
| > | >>
| > | >
| > | >
| > |
| > |
| >
| >
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top