ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingASP 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 May 2nd, 2000, 08:16 PM
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
Stored proc with a parameter

<i><b>Originally posted by : meipoon (meipoon1@yahoo.com)</b></i><br /><%<br />'Declare variables<br />dim conn<br />dim rs<br />dim strsql<br />dim strUserName<br /><br />'Set the information submitted to a local variable<br />strUserName= request("user_name")<br /><br />'Connection and Recordset object<br /> Set conn = Server.CreateObject("ADODB.Connection")<br /> Conn.Open "driver={SQL Server};server=ops02;uid=webreader;pwd=web;databas e=msdb"<br /> Server.ScriptTimeout = "120" <br /> conn.CommandTimeout = 240 <br /> <br />'Set the string that will be passed to the database and execute the <br />'stored procedure. This will return a recordset<br />strSql = "exec SP_GET_BILLING_INFO1" & strUserName<br />response.write strSql<br />set Rs = server.createobject("adodb.recordset")<br />Rs.open strSql, conn<br />rs.movefirst<br /> <br />%><br /><br /><TABLE BORDER="1" width="80%"><br /><TR> <br /><% For Each Field In RS.Fields %><br /><TH> <br /><%<br />response.write Field.name<br />%> <br /></TH> <br /><% Next %> <br /></TR><br />'This section writes out the DATA of the fields in the Recordset<br /><% Do While Not RS.EOF %> <br /><TR> <br /><% For Each Field In RS.Fields %> <br /><TD ALIGN=center> <br /><%<br />Response.Write Field.Value <br />%> <br /></TD><br /><% Next <br />RS.MoveNext %> <br /></TR> <br /><% Loop %> <br /></TABLE> <br /></body><br /><% <br />Rs.close<br />set Rs = nothing<br />conn.close<br />set conn = nothing<br />%><br /><br /><br /><br />Above is my asp output code, specified a parameter "user_name", but it wont work, could any one tell me what may go wrong? Thanks.<br />

Reply With Quote
  #2  
Old May 3rd, 2000, 04:41 PM
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
<i><b>Originally posted by : (kots_999@hotmail.com)</b></i><br />Hi<br />Try with a 'space' after sp_name.<br />exec "sp_name " & strUserName.<br />Kots<br /><br /><br /><br />------------<br />meipoon at 5/2/2000 6:16:16 PM<br /><br /><%<br />'Declare variables<br />dim conn<br />dim rs<br />dim strsql<br />dim strUserName<br /><br />'Set the information submitted to a local variable<br />strUserName= request("user_name")<br /><br />'Connection and Recordset object<br /> Set conn = Server.CreateObject("ADODB.Connection")<br /> Conn.Open "driver={SQL Server};server=ops02;uid=webreader;pwd=web;databas e=msdb"<br /> Server.ScriptTimeout = "120" <br /> conn.CommandTimeout = 240 <br /> <br />'Set the string that will be passed to the database and execute the <br />'stored procedure. This will return a recordset<br />strSql = "exec SP_GET_BILLING_INFO1" & strUserName<br />response.write strSql<br />set Rs = server.createobject("adodb.recordset")<br />Rs.open strSql, conn<br />rs.movefirst<br /> <br />%><br /><br /><TABLE BORDER="1" width="80%"><br /><TR> <br /><% For Each Field In RS.Fields %><br /><TH> <br /><%<br />response.write Field.name<br />%> <br /></TH> <br /><% Next %> <br /></TR><br />'This section writes out the DATA of the fields in the Recordset<br /><% Do While Not RS.EOF %> <br /><TR> <br /><% For Each Field In RS.Fields %> <br /><TD ALIGN=center> <br /><%<br />Response.Write Field.Value <br />%> <br /></TD><br /><% Next <br />RS.MoveNext %> <br /></TR> <br /><% Loop %> <br /></TABLE> <br /></body><br /><% <br />Rs.close<br />set Rs = nothing<br />conn.close<br />set conn = nothing<br />%><br /><br /><br /><br />Above is my asp output code, specified a parameter "user_name", but it wont work, could any one tell me what may go wrong? Thanks.<br />

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingASP Development > Stored proc with a parameter


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