Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Stored procedures via asp

Posted on 2013-05-24
3
Medium Priority
?
279 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 300 total points
ID: 39194981
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 54

Expert Comment

by:Scott Fell, EE MVE
ID: 39195017
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
ID: 39207786
This helped get me on the right path.  Thanks!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
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…

824 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