Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old December 10th, 2004, 04:13 AM
killerpm killerpm is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 103 killerpm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 21 m 58 sec
Reputation Power: 4
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?

Reply With Quote
  #2  
Old December 10th, 2004, 10:39 AM
Techy Techy is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 6 Techy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #3  
Old December 10th, 2004, 11:04 AM
freeasphelp's Avatar
freeasphelp freeasphelp is offline
Beyond The Impossible
ASP Free Novice (500 - 999 posts)
 
Join Date: Sep 2003
Location: Shawnee Mission, KS, USA
Posts: 921 freeasphelp User rank is Corporal (100 - 500 Reputation Level)freeasphelp User rank is Corporal (100 - 500 Reputation Level)freeasphelp User rank is Corporal (100 - 500 Reputation Level)freeasphelp User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 23 h 25 m 9 sec
Reputation Power: 6
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

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > What is the opposite of the EOF?!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway