User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 391,616 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,638 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 2648 | Replies: 1
Reply
Join Date: Apr 2004
Posts: 1
Reputation: MunMun is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
MunMun MunMun is offline Offline
Newbie Poster

Help Need Help with ASP

  #1  
Apr 22nd, 2004
i have create a database and a form. i need to check the input data before store it into the database. so that, there are no overlap data in my database. its in Asp langauge. thanks for your help.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2004
Location: Louisville, KY
Posts: 20
Reputation: DVHost is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
DVHost's Avatar
DVHost DVHost is offline Offline
Newbie Poster

Re: Need Help with ASP

  #2  
Apr 22nd, 2004
In the future you may want to be just a little bit more specific about your project such as the type of DB etc. But, here is a very easy method of checking records in an Access DB to see if they already exist:


<%
Dim rsGET
Set rsGET = Server.CreateObject("ADODB.Recordset")
rsGET.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\myDatabase.mdb"
rsGET.Source = "Select myRecord from myTable where myRecord = " + formValue
rsGET.CursorType = 0
rsGET.CursorLocation = 2
rsGET.LockType = 1
rsGET.Open()
 
If rsGET.BOF OR rsGET.EOF Then 
 
' NO MATCHING RECORDS FOUND CODE
 
Else
 
' FOUND MATCHING RECORDS CODE
 
End If
%> 
 
' Other html code here
 
<%
' Destroy and close the db connection
 
rsGET.Close()
Set rsGET = Nothing
%>


rsGET.BOF and rsGET.EOF stand for Beginning of File and End of File respectively.

To the server, if it reaches either end of the DB and has not found anything then it will fire the 'NO MATCHING RECORDS code. If it does find the record in question it will fire the FOUND MATCHING RECORD code after the Else statement.

Hope it helps!
The Big Dog, Bites Hard!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ASP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ASP Forum

All times are GMT -4. The time now is 12:26 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC