Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check Duplicates

Status
Not open for further replies.

neskin

Programmer
Joined
Mar 13, 2002
Messages
104
Location
AU
Hi there,
I have a search page.I need to check if the record exist first.If the record does not exist pass value of the fields from search page to result page.On the result page i have a stored procedure where I am passing them to get extra info.if the record exist
keep the user on the search page and let know that the record already exist
there is the code for record set
<%
Dim rsCheckDuplicates__company_id
rsCheckDuplicates__company_id = "0"
If (request.querystring("lstState") <> "") Then
rsCheckDuplicates__company_id = request.querystring("lstState")
End If
%>
<%
Dim rsCheckDuplicates__job_num
rsCheckDuplicates__job_num = "0"
If (request.querystring("txtjob_no") <> "") Then
rsCheckDuplicates__job_num = request.querystring("txtjob_no")
End If
%>
<%
Dim rsCheckDuplicates
Dim rsCheckDuplicates_numRows

Set rsCheckDuplicates = Server.CreateObject("ADODB.Recordset")
rsCheckDuplicates.ActiveConnection = MM_Henleyvic_apps_STRING
rsCheckDuplicates.Source = "SELECT * FROM dbo.tDMXCSurveDtls WHERE l_context_id = '" + Replace(rsCheckDuplicates__company_id, "'", "''") + "' and s_job_num = '" + Replace(rsCheckDuplicates__job_num, "'", "''") + "'"
rsCheckDuplicates.CursorType = 0
rsCheckDuplicates.CursorLocation = 2
rsCheckDuplicates.LockType = 1
rsCheckDuplicates.Open()

rsCheckDuplicates_numRows = 0
%>
 
so what is the problem? i dont see any duplication checking code???

Known is handfull, Unknown is worldfull
 
1. get the recordset
2. select/filter for the field
3. IF my_DB_field = form_field THEN
- record found, therefor attempting to make a duplicate
ELSE (nothing found)
...INSERT record
...

:--------------------------------------------------------------------------:
fugitive.gif

ok,ok...I did shoot the deputy but he told me he was the sheriff!
:--------------------------------------------------------------------------:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top