How to check the record if it is already in the database
S T E P - 1
- We use the SQL to search the record based on some decisions. For example:
Dim oConn
Dim oRs
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("db1.mdb")
Set oRs = oConn.Execute("SELECT * FROM member WHERE MemberID='" & strMemberID & "';")
' We search a single member record based on the MemberID
S T E P - 2
- We used the SQL command to filter the RecordSet.
- If the RecordCount = 0 , that means the record is not existed in the database:
If oRs.RecordCount = 0 Then
Response.Write("The record is not found")
End If
No comments:
Post a Comment