| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
What is the opposite of the EOF?!
Code:
<%
f request.form("account2")<>"" then
record6.open "select * from loan where loanid like'"&request.form("account2")&"'",db,1,3
end if
if record6.EOF then
Response.write("Already Took a loan")
else
record.open"select*from loan",db,1,3
record.addnew
record("loanid")=request.form("account2")
record("schema")=request.form("schema")
record("ldate")=request.form("adddate")
record.update
set record=nothing
end if
%>
what i want to do to check for me if he is already have a record on the loan if yes (msg " Already took a loan) , if no(Add record) i think we have to change the EOF to something.. so anybody have any idea? |
|
#2
|
|||
|
|||
|
hi,
It should be: If NOT record6.EOF AND NOT record6.BOF then i.e.Then we have a record for this account Regards, Tim |
|
#3
|
||||
|
||||
|
Try this:
Code:
<%
Dim strDbName, strDbPath, strCnn
strDbPath = Server.MapPath(".") & "\"
strDbName = "dbname.mdb"
strCnn = "Provider.Microsoft.Jet.OleDb.4.0;Data Source=" & strDbPath & strDbName & ";"
Dim strAccount2, strSchema, dtmAdded
strAccount2 = Request.Form("account2")
strSchema = Request.Form("schema")
dtmAdded = Now()
strSQL = "SELECT loanid From loan WHERE loanid like '" & strAccount2 & "';"
Dim objCnn, objRst
Set objCnn = Server.CreateObject("ADODB.Connection")
objCnn.ConnectionString = strCnn
Set objRst = objCnn.Execute(strSQL)
If objRst.BOF OR objRst.EOF Then
objRst.Close()
Set objRst = Nothing
strSQL = "INSERT INTO loan (loanid, schema, ldate) VALUES ('" & strAccount2 & "', '" & strSchema & "', #" & dtmAdded & "#);"
objCnn.Execute(strSQL), intRecords
objCnn.Close()
Set objCnn = Nothing
If intRecords = 1 Then
Response.Write("You have taken a loan!")
Else
Response.Write("Unkown Error!")
End If
Else
objRst.Close()
Set objRst = Nothing
objCnn.Close()
Set objCnn = Nothing
Response.Write("You have already taken a loan!")
End If
%>
__________________
John Shepard Beyond The Impossible ----------------------------- Has a post helped you? Please show your apprecitation by clicking the image in the right upper corner.Posting code? Put your code between [code] and [/code] tags. X-Login and X-Send |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > What is the opposite of the EOF?! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|