Solved

Stored procedures via asp

Posted on 2013-05-24
3
270 Views
Last Modified: 2013-05-30
Please help, I'm not a SQL guy.  Having trouble with closing a post survey on a stored procedure that works but cannot trigger it via asp.  This is a two part process with 2 asp pages and 2 stored procedures, the survey then a post thank you message and storage.  The first one works great.  In fact, I replaced the line  rs = C.Execute(sql) in Post with rs = C.Execute("sdnGetCallInfo '" + Request.QueryString("CallID")+ "'") from the Survey and the asp page actually display but, or course nothing records in the DB.  I attached the post.  Thanks for any advice...
Post.txt
0
Comment
Question by:captgriggs1
3 Comments
 
LVL 22

Accepted Solution

by:
Om Prakash earned 100 total points
Comment Utility
please check that sdnGetCallInfo  has update statement to record survey

examples:

http://stackoverflow.com/questions/15092616/sql-server-stored-procedure-for-asp-classic
http://support.microsoft.com/kb/164485
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
Comment Utility
Your right. It is  a 2 step thing.  First you have a stored procedure in your sql database.  Then you will have asp/vb code to talk to the db/stored procedure. I like to have this as an include file as a function.

In this sample I have a SP called addNewThing in my db that accepts @newThing

<%
' include adovbs file
theID=AddNewThing("Tonka Truck")
response.write theID


Function AddNewThing(widget)

Set cmd = Server.CreateObject("ADODB.Command")
With cmd

   	.ActiveConnection = connMyConnection
    .CommandType = adCmdStoredProc
   	.CommandText = "addNewThing" ' name of your stored procedure
   
   	.Parameters.Append .CreateParameter("@newThing",adVarWChar, adParamInput, 50)
   	.Parameters("@newThing") = widget

   set rsName = .Execute
End With

 AddNewThing= rs(0) 
 
set cmd = nothing
set rs = nothing

end Function

%>

Open in new window

0
 

Author Closing Comment

by:captgriggs1
Comment Utility
This helped get me on the right path.  Thanks!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now