Active Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 1751
Number of posts: 4473

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
db problemo Posted by fas on 26 May 2004 at 12:34 PM
im having problem with this code its not redirecting .. the record set's current count is -1 no rows are returning from db...plz a quivk help is required

<%
id=request.form("usr")
sec=request.form("pwd")
'response.write(id)
'response.write(sec)
set con=Server.createobject("Adodb.connection")
set rs=Server.createobject("Adodb.recordset")
con.open "DSN=test;usr=;pwd=;"
sql="select * from user where userid='"&id&"' and pass='"&sec&"'" //////"'this is the query..."\\\\\\
rs.Open sql,con

if (rs.recordcount > 0) then
Session("auth")="allow"
response.redirect("success.asp")
else
response.redirect("error.asp")
end if
%>
Report
Re: db problemo Posted by Flakes on 26 May 2004 at 10:12 PM
: im having problem with this code its not redirecting .. the record set's current count is -1 no rows are returning from db...plz a quivk help is required
:
: <%
: id=request.form("usr")
: sec=request.form("pwd")
: 'response.write(id)
: 'response.write(sec)
: set con=Server.createobject("Adodb.connection")
: set rs=Server.createobject("Adodb.recordset")
: con.open "DSN=test;usr=;pwd=;"
: sql="select * from user where userid='"&id&"' and pass='"&sec&"'" //////"'this is the query..."\\\\\\
rs.Open sql,con,2,3
:
: if (rs.recordcount > 0) then
: Session("auth")="allow"
: response.redirect("success.asp")
: else
: response.redirect("error.asp")
: end if
: %>
:


Change the rs.open statement as shown.The default cursor type might not be supporting the recordcount.The "2,3" thing is I *think* adOpenDynamic and adLockOptimistic . Can't really remember that thing .
If that doesn't work ,try setting
rs.cursorLocation=adUseClient before opening the resordset.
to use the adUseClient ,you will have to include the file "adovbs.inc".If you look in that file you will also see what 2,3 stands for and what the magic number for adUseClient is.Try it and let us know

Report
Re: db problemo Posted by mhadgutrajaram on 27 May 2004 at 3:12 AM

Hi friend ,

Always use the given approach for using recodset


<%
id=request.form("usr")
sec=request.form("pwd")
'response.write(id)
'response.write(sec)
set con=Server.createobject("Adodb.connection")
set rs=Server.createobject("Adodb.recordset")
con.open "DSN=test;usr=;pwd=;"
sql="select * from user where userid='"&id&"' and pass = '"&sec&"'" //////"'this is the query..."\\\\\\
rs.ActiveConnection = con
rs.LockType = 3 'adLockOptimistic
rs.CursorLocation = 3 'adUseClient
rs.CursorType = 2 'adOpenDynamic
rs.open(sql)

if (rs.recordcount > 0) then
Session("auth")="allow"
response.redirect("success.asp")
else
response.redirect("error.asp")
end if
%>


This will surely solve ur problem.

Regads,

Rajaram Mhadgut :)

you can contact me at mhadgutrajaram@hotmail.com


: im having problem with this code its not redirecting .. the record set's current count is -1 no rows are returning from db...plz a quivk help is required
:
: <%
: id=request.form("usr")
: sec=request.form("pwd")
: 'response.write(id)
: 'response.write(sec)
: set con=Server.createobject("Adodb.connection")
: set rs=Server.createobject("Adodb.recordset")
: con.open "DSN=test;usr=;pwd=;"
: sql="select * from user where userid='"&id&"' and pass='"&sec&"'" //////"'this is the query..."\\\\\\
: rs.Open sql,con
:
: if (rs.recordcount > 0) then
: Session("auth")="allow"
: response.redirect("success.asp")
: else
: response.redirect("error.asp")
: end if
: %>
:




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.