|
| |
|
|
rubyrube
Posts: 16 Joined: 1/4/2005 Status: offline
|
Checking for duplicate records via DRW SOLVED! - 1/7/2005 10:23:19
I figured out how to use the DRW to check the database before entering records to prevent duplicate records. I wanted to share this with other FrontPage users. You do not have to write your own ASP code to do this, although doing so might give you more efficient code. You’ll need to add one ASP ‘If..Then’ statement to either send the user to a negative confirmation page OR add the record. You simply use the DRW to create a “count page” of the records you’re looking for. Something like this (custom query): "SELECT COUNT(*) FROM Questions WHERE (User_name = '" & Request.Form("Username") & "') AND (Question = '" & Request.Form("Question") &"');" Then simply snatch the code that DRW creates, and add ut to the top of the DRW page that inserts the records. fp_sQry="SELECT COUNT(*) FROM Questions WHERE (User_name = '" & Request.Form("Username") & "') AND (Question = '" & Request.Form("Question") &"');" fp_sDefault="” fp_sNoRecords="" fp_sDataConn="PW_Question" fp_iMaxRecords=1 fp_iCommandType=1 fp_iPageSize=0 fp_fTableFormat=True fp_fMenuFormat=False fp_sMenuChoice="Expr1000" fp_sMenuValue="Expr1000" fp_sColTypes="&Expr1000=3&" fp_iDisplayCols=1 fp_fCustomQuery=True BOTID=0 fp_iRegion=BOTID %> <!--#include file="../_fpclass/fpdbrgn1.inc"--> <% Dim Count Count = FP_FieldVal(fp_rs,"Expr1000") %> <!--#include file="../_fpclass/fpdbrgn2.inc"--> <% If Count >= 1 Then 'Already in the database Response.Redirect "PWQC_BAD.asp" End IF %> ….add to the DB below here…. It works for me. Reuben Ruby-rube
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|