Forums

ASP

This topic is locked

Recordset and Stored Procedure issues!

Posted 23 Jun 2009 16:43:22
1
has voted
23 Jun 2009 16:43:22 wb va posted:
Below is my stored procedure:


CREATE PROCEDURE spTestEdit1

(@username nvarchar(50) 

)

AS

SELECT [TEST-1]
      ,[username]
      ,[FirstName]
      ,[Surname]
FROM [dbTestSQL].[dbo].[TEST-1]
  WHERE username=@username


and below is my asp page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--#include file= "../connection/conn.asp" -->

<


%'Checking to see what request is being submitted
	'IF  Request.Form("submit")="submit" Then
	
	username=request.form("username")    ' Get the unique Ref being searched for
	
	'create a record set
set rs = Server.CreateObject("ADODB.RecordSet") 
	'Query the database
	
	
		SQL="spTestEdit1 " + spud(session("username"))
		
				
		rs.open sql, conn, 1, 1
		IF NOT rs.eof THEN
		  
		  response.write sql
		

%>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>

<link rel="stylesheet" href="../includes/calendar-blue.css" type="text/css"/>
<link rel="stylesheet" href="../includes/new_amended1.css" type="text/css"/>
<script src="../includes/calendar.js" language="javascript" type="text/javascript"></script>
<script src="../includes/calendar-en.js" language="javascript" type="text/javascript"></script>
<script src="../includes/calendar-setup.js" language="javascript" type="text/javascript"></script>

</head>



<body>


    <form id="form2" runat="server">
    </form>
    
    <form id="form1" runat="server">
    </form>
    
    <div id="frame">
    
    <div id="topHeader"></div>
    
    <div id="wrappermain">
        
        <div id="contentcenter">
           
            <form action="../sql/update/update3_extra.asp" 
            method="POST">
            
              
        <p class="emailtop">Email Address 
		<input class="emailbox formpush formText" name="username" size="30" type="text" value="<%Response.Write(Session("username"))%>" /></p>
        
            <fieldset class="header">
               
                <legend>User Information</legend>
                
                <p class="floatp">First Name</p>
                
                <input class="floatv formText formpush" name="FirstName" size="30" type="text"  value="<%=response.write(rs("FirstName"))%>" />
                
                <p class="floatp">Surname</p>               
                <input class="floatv formText formpush" name="Surname" size="30" type="text" value="<%=response.write(rs("Surname"))%>" />
                
 <
%ELSE response.write("Please close this page and try again")


'free the buffer by closing all the recordsets and the connection
rs.close
set rs= Nothing
conn.close
set conn= Nothing
END IF
'END IF
%>


my problem is, i cant get the asp page to return the UserName, FirstName, Surrname, from the recordset.

Im deseperate, any ideas?????? :confused::confused::confused:

Replies

Replied 23 Jun 2009 16:45:35
23 Jun 2009 16:45:35 wb va replied:
i have tried changing the SQL = line to this:

SQL="EXEC spTestEdit1 '" & spud(session("username")) & "'"


But the page now is calling my ELSE statement which says :

"Please close this page and try again"

which tells me that the RS isnt filling up.. any ideas?

Reply to this topic