954,566 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Need Help with ASP

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.

MunMun
Newbie Poster
1 post since Apr 2004
Reputation Points: 10
Solved Threads: 0
 

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 codeafter the Else statement.

Hope it helps!

DVHost
Newbie Poster
20 posts since Apr 2004
Reputation Points: 10
Solved Threads: 0
 

I took a look at your site and recommend it to my visitors. I agree with you on the importance of becoming valuable in many different areas. I believe that it sustains any entrepreneur during challenges that inevitably occur.
------------------
Mobin

dassmobin
Newbie Poster
1 post since Sep 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You