Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
lappin
Posting Yak Master
182 Posts |
Posted - 2011-10-21 : 09:07:25
|
Hi, not sure if this is correct place to put this but...From a webpage I am calling a stored procedure once, but in the trace it is called twice and inserting data twice. I have added a messagebox before the call and this is only firing once so there is no double-call from webpage.Has anyone had this happen before?Here is snippet from trace:exec sp_reset_connection goexec myStoredProcedure @param1=N'test'goexec sp_reset_connection goexec myStoredProcedure @param1=N'test'goexec sp_reset_connection Add here is code from webpage Protected Sub myListview_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewInsertEventArgs) Handles myListview.ItemInsertingMessagebox.Show("inserting here") Dim strMyvalue1 as String ="test" dsGrid.InsertCommand = "myStoredProcedure" dsGrid.InsertCommandType = SqlDataSourceCommandType.StoredProcedure dsGrid.InsertParameters.Clear() dsGrid.InsertParameters.Add(New Parameter("param1", Data.DbType.String, strMyvalue1)) dsGrid.Insert()End Sub |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-21 : 09:13:10
|
have you added statement start and completion events both in trace? if yes it will be listed twice but only one (completed) will have details------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
lappin
Posting Yak Master
182 Posts |
Posted - 2011-10-21 : 09:41:21
|
No there are two starting and two completed. The data is being inserted twice also. Just in-case I've also ran procedure from SSMS in-case my procedure had a bug in it, but it runs fine and only inserts a single row.Here are few lines from trace:-----------------------------------First Starting---------------------------------------- <Event id="11" name="RPC:Starting">..... <Column id="14" name="StartTime">2011-10-21T14:28:56.993+01:00</Column>... <Column id="1" name="TextData">exec MyStoredProcedure ....</Column> -------------------------------------Second Starting --------------------------------<Event id="11" name="RPC:Starting"> ...... <Column id="14" name="StartTime">2011-10-21T14:28:57.01+01:00</Column>... <Column id="1" name="TextData">exec MyStoredProcedure ....</Column>Edit: should have said - this is a test server and test website with no other users. |
 |
|
lappin
Posting Yak Master
182 Posts |
Posted - 2011-10-21 : 09:51:21
|
Found cause of my problem. It was in webpage. When I removed "dsGrid.Insert()" the proc only ran once, not 100% sure why - guess it is also being inserted on click. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-21 : 09:54:03
|
is there some postback set at front end?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|