Triggerhttp://forums.asp.net/t/1797225.aspx/1?TriggerWed, 02 May 2012 08:43:46 -040017972254952549http://forums.asp.net/p/1797225/4952549.aspx/1?TriggerTrigger <p>Whenever I run the form and complete the procedure then I need to go back to sql database and click on execute. I want to avoid everytime going back and executing each entry because if I don't execute everytime then the further other [b]form data [/b]will not be[b] retrieved[/b] properly as the [b]previous form[/b] will [b]not be updated[/b]. I hope ur understanding ...<br> I have written the query in the [b]form code[/b] itself.<br> I have used [b]trigger[/b] once but that was on the Database side itself.<br> so,this time I am not understanding what to do!!<br> So what is the solution to make the database execute automatically once the code is being executed i.e. the details are sent to database?</p> 2012-04-26T10:14:39-04:004952569http://forums.asp.net/p/1797225/4952569.aspx/1?Re+TriggerRe: Trigger <p>You can create a Stored Procedure and put in whatever logic you need to perform on your Data, now you can call this stored procedure from asp.net code.</p> 2012-04-26T10:23:03-04:004953171http://forums.asp.net/p/1797225/4953171.aspx/1?Re+TriggerRe: Trigger <h3 class="post-title"><a title="nijhawan.saurabh" href="http://forums.asp.net/members/nijhawan.saurabh.aspx">nijhawan.saurabh</a></h3> <p>I don't know how to do this...So I asked here.</p> 2012-04-26T14:46:54-04:004954015http://forums.asp.net/p/1797225/4954015.aspx/1?Re+TriggerRe: Trigger <h3 class="post-title"><a title="nijhawan.saurabh" href="http://forums.asp.net/members/nijhawan.saurabh.aspx">nijhawan.saurabh</a>&nbsp;</h3> <p>did u mean to remove the query command code of form side and put it in stored procedure and then call this stored procedure from form side?</p> 2012-04-27T03:15:19-04:004954238http://forums.asp.net/p/1797225/4954238.aspx/1?Re+TriggerRe: Trigger <p></p> <blockquote><span class="icon-blockquote"></span> <h4>IAmateur</h4> <p></p> <h3 class="post-title"><a title="nijhawan.saurabh" href="http://forums.asp.net/members/nijhawan.saurabh.aspx">nijhawan.saurabh</a>&nbsp;</h3> <p>did u mean to remove the query command code of form side and put it in stored procedure and then call this stored procedure from form side?</p> <p></p> </blockquote> <p></p> <p>Correct!</p> 2012-04-27T06:37:38-04:004954404http://forums.asp.net/p/1797225/4954404.aspx/1?Re+TriggerRe: Trigger <p>What is the syntax to cal stored procedure from code side?</p> 2012-04-27T08:13:44-04:004954412http://forums.asp.net/p/1797225/4954412.aspx/1?Re+TriggerRe: Trigger <p>Hello,</p> <p>Follow the thread below. It will help you</p> <p>http://support.microsoft.com/kb/306574</p> 2012-04-27T08:19:01-04:004961226http://forums.asp.net/p/1797225/4961226.aspx/1?Re+TriggerRe: Trigger <p></p> <blockquote><span class="icon-blockquote"></span> <h4>IAmateur</h4> <p></p> <p>What is the syntax to cal stored procedure from code side?</p> <p></p> </blockquote> <p></p> <p>Hi,</p> <p>You could write like this:</p> <pre class="prettyprint">SqlConnection conn = new SqlConnection(&quot;your_sql_server_connection_string&quot;); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = &quot;your sp's name&quot;; //add values to paramters. cmd.Parameters.AddWithValue(&quot;@name1&quot;, &quot;name1&quot;); conn.Open(); cmd.Connection = conn; cmd.ExecuteNonQuery(); conn.Close();</pre> <p>Thanks.</p> 2012-05-02T08:43:46-04:00