472,125 Members | 1,477 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,125 software developers and data experts.

Calling a Stored Procedure in an ASP Page

Hi,

I have created a Stored Procedure Sp_test for Triggering the Mails.

Can anybody tell me how to Call it inside the function cmdSubmit_onclick()

which is a part of the ASP Script so that I can execute the same.

Any help will be really appreciated.


Thanks & Regards,
Praveen
Sep 10 '07 #1
2 1964
jhardman
3,406 Expert 2GB
Praveen,

Everything in ASP scripts are executed before the page is sent to the browser. After the browser displays the page and the user begins interacting with it, no more asp procedures can work. The best way to handle this is that on the resulting page where the user visits after clicking the cmdSubmit button the stored procedure is called as the script is executing. I hope this makes sense.

Jared
Sep 11 '07 #2
ilearneditonline
130 Expert 100+
If this is classic ASP, then the solution Jared recommended would be the easiest to implement. If this is ASP.NET, then you just associate the method with the button. If it is vb.net then it would be something like...

Expand|Select|Wrap|Line Numbers
  1.  Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
  2. ' call you stored procedure
  3. End Sub
c#
Expand|Select|Wrap|Line Numbers
  1. // in the asp.net page
  2. <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
  3.  
  4. // in code behind or inline
  5. protected void Button1_Click(object sender, EventArgs e)
  6. {
  7. // call stored procedure
  8. }
  9.  
If it is classic asp, and you want to call it without changing pages, you should look at using AJAX and call the stored procedure in a server side page.
Sep 11 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Bob Murdoch | last post: by
18 posts views Thread by Jarrod Morrison | last post: by
2 posts views Thread by Woody Splawn | last post: by
2 posts views Thread by =?Utf-8?B?YW5vb3A=?= | last post: by
4 posts views Thread by raghuvendra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.