SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

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 July 25th, 2000, 04:42 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
Problem with stored procedure using OLEDB

<i><b>Originally posted by : Lynn (Lynnkuo2000@yahoo.com)</b></i><br /><br />I have problem of using OLEDB for calling any stored procedure which has any update or insert statement and then return with select statement, but with the same stored procedure using DSN then it's okay. <br />This is the asp code. I got the error at line oRS(0). For some reason, it thinks that the recordset is already closed.<br /><br />DSN_Extranet = "PROVIDER=SQLOLEDB;SERVER=intrainfo;DATABASE=info;U ID=lynn;PWD=lynn;"<br />oConn.open DSN_EXTRANET<br /><br />strSql = "chkLoginPassword " <br />strSql = strSql & "'" & replace(rtrim(Request.Form("loginname")), "'", "''") & "', " <br />strSql = strSql & "'" & replace(rtrim(Request.Form("password")), "'", "''") & "' "<br /><br />Set oCmd = Server.CreateObject("ADODB.Command")<br />Set oCmd.ActiveConnection = oConn<br />oCmd.CommandType = adCmdStoredProc<br />oCmd.CommandText = strSql<br />Set oRS = oCmd.Execute <br /><br />strName = oRS(0)<br /><br /><br /><br />Error Type:<br />ADODB.Recordset (0x800A0CC1)<br />Item cannot be found in the collection corresponding to the requested name or ordinal.<br /><br /><br />Here is my stored procedure. If I comment it out the update statement then everything is fine.<br /><br />Thanks for any help.<br /><br /><br /><br />create procedure dbo.chkLoginPassword ( @pUserid char(20), @pPassword char(20) )<br />as <br />begin<br />declare @xxx char(20), @rand char(30), @userid char(20), @cid int<br /><br />if exists ( select userid from users<br /> where userid = @pUserid<br /> and password = @pPassword )<br />begin<br /><br /><br />select @xxx = convert(char(20), getdate(), 14)<br />select @rand = substring(convert( char(30), rand(), 2),3,12) + substring(@xxx, 4,2) + substring(@xxx, 7,2) + substring(@xxx, 10,3) + substring(convert( char(30), rand(), 2),3,12)<br /><br />update Users<br />set EncryptUserid = @rand,<br />LastLoginTime = getdate()<br />where userid = @pUserid<br />and password = @pPassword <br /><br />select @rand<br /><br />end <br />else <br />begin<br />select -1<br />end <br /><br />end

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Problem with stored procedure using OLEDB


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 1 hosted by Hostway
Stay green...Green IT