Showing posts with label page. Show all posts
Showing posts with label page. Show all posts

Wednesday, March 28, 2012

Ok got the per page sorted but...

i get a blank page after each record so 13 records, when previewed, adds upto 26 page 13 of which are blank.

I noticed a post here about having nothing after the grouping and as far as i can see i have not, but i dont really know what that means.....

Any help is appreciated, so close yet so far :-)
Which renderer are you using? If it's the PDF or Image renderer, please check the size of your report body and margins to make sure it doesn't exceed the page size.|||Yep found that and all is fixed.

Many thanks for the help

:-)

Monday, March 26, 2012

OK button is not working on file upload page

Hi everybody,
I hope than somebody can help me to fix my reporting services server.
I can upload reports on my reportin services server i dont know why but when
i press the OK button nothings happend everything is working bit i need to to
ulpload to new reports but i can't...
maybe if smebody know some diagnostic tool than can help to fix the problem
will be great.
plase, help....
Thanks.This happened to me once. But with the Apply button in the parameters section
of the report manager. This indicates the installation of reporting services
is corrupted and I had to reinstall it on the server.
Maybe that's not the problem for you, but it solved my problem.
"Edman" wrote:
> Hi everybody,
> I hope than somebody can help me to fix my reporting services server.
> I can upload reports on my reportin services server i dont know why but when
> i press the OK button nothings happend everything is working bit i need to to
> ulpload to new reports but i can't...
> maybe if smebody know some diagnostic tool than can help to fix the problem
> will be great.
> plase, help....
> Thanks.

Wednesday, March 21, 2012

Odd sqldatasource insert behavior

I have a sqldatasource (code listed below) whose insert Paramaters are control parameters. My aspx page has a textbox and a submit button. the button onclick runs the sqdatasource1.insert.

What I get is every other insert inserts the text in textbox2 and every other insert enters nothing for the namecust value. I have a required field validator which correctly prevents submission if textbox2 is empty.

How do I fix this?

:<code>

<asp:PanelID="Panel1"runat="server"Height="50px"Width="548px">

<asp:ButtonID="Button1"runat="server"Text="New Prospect"ValidationGroup="insertCust"/>

<asp:RequiredFieldValidatorID="RequiredFieldValidator1"runat="server"ControlToValidate="TextBox2"

ErrorMessage="Prospect Name can not be blank"ValidationGroup="insertCust"></asp:RequiredFieldValidator>

<asp:TextBoxID="TextBox2"runat="server"Width="330px"ValidationGroup="insertCust"></asp:TextBox></asp:Panel>

<asp:SqlDataSourceID="SqlDataSource2"runat="server"ConnectionString="<%$ ConnectionStrings:AccPac2ConnectionString %>"

SelectCommand="SELECT DISTINCT CODETERR FROM dbo.F_arcus() AS F_arcus_1 WHERE (DATEINAC = 0) AND (rtrim(CODETERR) <>'')">

</asp:SqlDataSource>

<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:AccPac2ConnectionString %>"

InsertCommand="INSERT INTO dbo.BudgetProspects(NameCust, CodeTerr) VALUES (@.Namecust, @.codeterr)"

SelectCommand="SELECT CustomerID, NameCust FROM dbo.BudgetProspects WHERE (CodeTerr = @.codeterr)"

UpdateCommand="UPDATE dbo.BudgetProspects SET NameCust = @.namecust">

<UpdateParameters>

<asp:ParameterName="namecust"/>

</UpdateParameters>

<SelectParameters>

<asp:ControlParameterControlID="RadioButtonList1"Name="codeterr"PropertyName="SelectedValue"/>

</SelectParameters>

<InsertParameters>

<asp:ControlParameterControlID="textbox2"Name="Namecust"PropertyName="text"/>

<asp:ControlParameterControlID="RadioButtonList1"Name="codeterr"PropertyName="SelectedValue"/>

</InsertParameters>

</asp:SqlDataSource>

</code>

codebehind button_click:

<code>

ProtectedSub Button1_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles Button1.Click

IfNot TextBox2.TextIsNothingThen

SqlDataSource1.Insert()

TextBox2.Text =""

EndIf

EndSub

</code>

Never mind, complete stupidity on my part the altenate row style had white background and white text. Embarrassed [:$]

Tuesday, March 20, 2012

Odd Blocking Issue - Page Lock on CREATE PROC?

I don't understand why a CREATE PROC from 3.5 hours ago is the head blocker.
The SP wasn't changed since in months so this must be a compile/recompile?
It's not a COMPILE lock though but a PAGE lock. It's certainly not the
initial creation. What else can be done to debug this? It's happening and
usually resolving itself in 4-6 hours or if I kill the head blocker myself.
It doesn't happen every day but almost every day.
I've retrieved this info about the blocking from DMVStats and found similar
info using my regular blocking info script also pulling info from DMV's.
I'm running SQL 2005 SP2 Enterprise.
statement started 6:35AM
waiting statement (PAGE lock):
insert into grades (blah,blah)
select blah blah from homework join blah blah
statement started at 3:01AM
blocking statement: ============================================= -- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- ============================================= CREATE PROCEDURE [dbo].[ResultsHomeworkDelete]
@.homeworkResultId int,
@.NumDeleted int output
AS
delete homeworksessions where homeworkresult_id = @.homeworkresultId
set @.NumDeleted=@.@.ROWCOUNT
delete homeworkresults where homeworkresult_id=@.homeworkresultId
set @.NumDeleted=@.NumDeleted + @.@.ROWCOUNTDemi,
I don't think that the CREATE PROCEDURE is blocking anything, but someone is
running this procedure and it is blocking on some internal step. If you are
getting this string from sys.dm_exec_sql_text you will need to look at the
start and end offsets to see which statement in the procedure is actually
running.
You can get these from:
select sql_handle, statement_start_offset, statement_end_offset from
sys.dm_exec_requests
RLF
"Demi" <Demi@.discussions.microsoft.com> wrote in message
news:9DDA2A4C-F1E3-47B1-B523-28ECD0CAEC3A@.microsoft.com...
>I don't understand why a CREATE PROC from 3.5 hours ago is the head
>blocker.
> The SP wasn't changed since in months so this must be a compile/recompile?
> It's not a COMPILE lock though but a PAGE lock. It's certainly not the
> initial creation. What else can be done to debug this? It's happening and
> usually resolving itself in 4-6 hours or if I kill the head blocker
> myself.
> It doesn't happen every day but almost every day.
> I've retrieved this info about the blocking from DMVStats and found
> similar
> info using my regular blocking info script also pulling info from DMV's.
> I'm running SQL 2005 SP2 Enterprise.
> statement started 6:35AM
> waiting statement (PAGE lock):
> insert into grades (blah,blah)
> select blah blah from homework join blah blah
> statement started at 3:01AM
> blocking statement: =============================================> -- Author: <Author,,Name>
> -- Create date: <Create Date,,>
> -- Description: <Description,,>
> -- =============================================> CREATE PROCEDURE [dbo].[ResultsHomeworkDelete]
> @.homeworkResultId int,
> @.NumDeleted int output
> AS
> delete homeworksessions where homeworkresult_id = @.homeworkresultId
> set @.NumDeleted=@.@.ROWCOUNT
> delete homeworkresults where homeworkresult_id=@.homeworkresultId
> set @.NumDeleted=@.NumDeleted + @.@.ROWCOUNT|||Thanks. I will find out which statement, but it's going to be one delete
statement or the other and both are trivial. Since this SP call is the head
blocker I have no information that I can see about what made IT block. It
has no parent blocker, it's just stuck. How can I proceed investigating?
"Russell Fields" wrote:
> Demi,
> I don't think that the CREATE PROCEDURE is blocking anything, but someone is
> running this procedure and it is blocking on some internal step. If you are
> getting this string from sys.dm_exec_sql_text you will need to look at the
> start and end offsets to see which statement in the procedure is actually
> running.
> You can get these from:
> select sql_handle, statement_start_offset, statement_end_offset from
> sys.dm_exec_requests
> RLF
> "Demi" <Demi@.discussions.microsoft.com> wrote in message
> news:9DDA2A4C-F1E3-47B1-B523-28ECD0CAEC3A@.microsoft.com...
> >I don't understand why a CREATE PROC from 3.5 hours ago is the head
> >blocker.
> > The SP wasn't changed since in months so this must be a compile/recompile?
> > It's not a COMPILE lock though but a PAGE lock. It's certainly not the
> > initial creation. What else can be done to debug this? It's happening and
> > usually resolving itself in 4-6 hours or if I kill the head blocker
> > myself.
> > It doesn't happen every day but almost every day.
> >
> > I've retrieved this info about the blocking from DMVStats and found
> > similar
> > info using my regular blocking info script also pulling info from DMV's.
> >
> > I'm running SQL 2005 SP2 Enterprise.
> >
> > statement started 6:35AM
> > waiting statement (PAGE lock):
> >
> > insert into grades (blah,blah)
> > select blah blah from homework join blah blah
> >
> > statement started at 3:01AM
> > blocking statement: =============================================> > -- Author: <Author,,Name>
> > -- Create date: <Create Date,,>
> > -- Description: <Description,,>
> > -- =============================================> > CREATE PROCEDURE [dbo].[ResultsHomeworkDelete]
> > @.homeworkResultId int,
> > @.NumDeleted int output
> > AS
> >
> > delete homeworksessions where homeworkresult_id = @.homeworkresultId
> >
> > set @.NumDeleted=@.@.ROWCOUNT
> >
> > delete homeworkresults where homeworkresult_id=@.homeworkresultId
> >
> > set @.NumDeleted=@.NumDeleted + @.@.ROWCOUNT
>
>|||Demi,
Perhaps you have an orphaned connection, as mentioned here:
http://support.microsoft.com/kb/137983/en-us
and at the end of this article:
http://support.microsoft.com/kb/224453/en-us
The solution offered for 2005 is the KILL command:
http://msdn2.microsoft.com/en-us/library/ms173730.aspx
Also, I have found that sometimes having the computer that made the
connection log off of the domain, and then log back in again, will alert SQL
Server that all is not well with the existing transaction and it will roll
back. (Kind of like it 'sees' the computer login, says to itself "Then this
transaction must be junk", and throws it away.)
RLF
"Demi" <Demi@.discussions.microsoft.com> wrote in message
news:21C07BE7-E2F4-4A3F-B7D8-24D57C09DE10@.microsoft.com...
> Thanks. I will find out which statement, but it's going to be one delete
> statement or the other and both are trivial. Since this SP call is the
> head
> blocker I have no information that I can see about what made IT block. It
> has no parent blocker, it's just stuck. How can I proceed investigating?
> "Russell Fields" wrote:
>> Demi,
>> I don't think that the CREATE PROCEDURE is blocking anything, but someone
>> is
>> running this procedure and it is blocking on some internal step. If you
>> are
>> getting this string from sys.dm_exec_sql_text you will need to look at
>> the
>> start and end offsets to see which statement in the procedure is actually
>> running.
>> You can get these from:
>> select sql_handle, statement_start_offset, statement_end_offset from
>> sys.dm_exec_requests
>> RLF
>> "Demi" <Demi@.discussions.microsoft.com> wrote in message
>> news:9DDA2A4C-F1E3-47B1-B523-28ECD0CAEC3A@.microsoft.com...
>> >I don't understand why a CREATE PROC from 3.5 hours ago is the head
>> >blocker.
>> > The SP wasn't changed since in months so this must be a
>> > compile/recompile?
>> > It's not a COMPILE lock though but a PAGE lock. It's certainly not the
>> > initial creation. What else can be done to debug this? It's happening
>> > and
>> > usually resolving itself in 4-6 hours or if I kill the head blocker
>> > myself.
>> > It doesn't happen every day but almost every day.
>> >
>> > I've retrieved this info about the blocking from DMVStats and found
>> > similar
>> > info using my regular blocking info script also pulling info from
>> > DMV's.
>> >
>> > I'm running SQL 2005 SP2 Enterprise.
>> >
>> > statement started 6:35AM
>> > waiting statement (PAGE lock):
>> >
>> > insert into grades (blah,blah)
>> > select blah blah from homework join blah blah
>> >
>> > statement started at 3:01AM
>> > blocking statement: =============================================>> > -- Author: <Author,,Name>
>> > -- Create date: <Create Date,,>
>> > -- Description: <Description,,>
>> > -- =============================================>> > CREATE PROCEDURE [dbo].[ResultsHomeworkDelete]
>> > @.homeworkResultId int,
>> > @.NumDeleted int output
>> > AS
>> >
>> > delete homeworksessions where homeworkresult_id = @.homeworkresultId
>> >
>> > set @.NumDeleted=@.@.ROWCOUNT
>> >
>> > delete homeworkresults where homeworkresult_id=@.homeworkresultId
>> >
>> > set @.NumDeleted=@.NumDeleted + @.@.ROWCOUNT
>>|||That's an interesting theory. We do have an overnight process kicked off
from a http handler that runs for 30 minutes until the page timeout kicks in.
The job has to run off hours and is essentially a processing loop so we
limit how long it can go and it often doesn't have time to finish all items
some days before the timeout. We have the database connection inside a
"using" block so I figured the transaction in progress should be rolled back
and the connection closed. Is there a possibility that this isn't always the
case? If so is there anything we can really do in .NET to make the timeout
clean up resources any more safely? Would catching ThreadAbortException and
closing the connection explicitly help at all?
We're not using a domain logon environment. This is coming from a webserver
frontend.
"Russell Fields" wrote:
> Demi,
> Perhaps you have an orphaned connection, as mentioned here:
> http://support.microsoft.com/kb/137983/en-us
> and at the end of this article:
> http://support.microsoft.com/kb/224453/en-us
> The solution offered for 2005 is the KILL command:
> http://msdn2.microsoft.com/en-us/library/ms173730.aspx
> Also, I have found that sometimes having the computer that made the
> connection log off of the domain, and then log back in again, will alert SQL
> Server that all is not well with the existing transaction and it will roll
> back. (Kind of like it 'sees' the computer login, says to itself "Then this
> transaction must be junk", and throws it away.)
> RLF
> "Demi" <Demi@.discussions.microsoft.com> wrote in message
> news:21C07BE7-E2F4-4A3F-B7D8-24D57C09DE10@.microsoft.com...
> >
> > Thanks. I will find out which statement, but it's going to be one delete
> > statement or the other and both are trivial. Since this SP call is the
> > head
> > blocker I have no information that I can see about what made IT block. It
> > has no parent blocker, it's just stuck. How can I proceed investigating?
> >
> > "Russell Fields" wrote:
> >
> >> Demi,
> >>
> >> I don't think that the CREATE PROCEDURE is blocking anything, but someone
> >> is
> >> running this procedure and it is blocking on some internal step. If you
> >> are
> >> getting this string from sys.dm_exec_sql_text you will need to look at
> >> the
> >> start and end offsets to see which statement in the procedure is actually
> >> running.
> >>
> >> You can get these from:
> >>
> >> select sql_handle, statement_start_offset, statement_end_offset from
> >> sys.dm_exec_requests
> >>
> >> RLF
> >>
> >> "Demi" <Demi@.discussions.microsoft.com> wrote in message
> >> news:9DDA2A4C-F1E3-47B1-B523-28ECD0CAEC3A@.microsoft.com...
> >> >I don't understand why a CREATE PROC from 3.5 hours ago is the head
> >> >blocker.
> >> > The SP wasn't changed since in months so this must be a
> >> > compile/recompile?
> >> > It's not a COMPILE lock though but a PAGE lock. It's certainly not the
> >> > initial creation. What else can be done to debug this? It's happening
> >> > and
> >> > usually resolving itself in 4-6 hours or if I kill the head blocker
> >> > myself.
> >> > It doesn't happen every day but almost every day.
> >> >
> >> > I've retrieved this info about the blocking from DMVStats and found
> >> > similar
> >> > info using my regular blocking info script also pulling info from
> >> > DMV's.
> >> >
> >> > I'm running SQL 2005 SP2 Enterprise.
> >> >
> >> > statement started 6:35AM
> >> > waiting statement (PAGE lock):
> >> >
> >> > insert into grades (blah,blah)
> >> > select blah blah from homework join blah blah
> >> >
> >> > statement started at 3:01AM
> >> > blocking statement: =============================================> >> > -- Author: <Author,,Name>
> >> > -- Create date: <Create Date,,>
> >> > -- Description: <Description,,>
> >> > -- =============================================> >> > CREATE PROCEDURE [dbo].[ResultsHomeworkDelete]
> >> > @.homeworkResultId int,
> >> > @.NumDeleted int output
> >> > AS
> >> >
> >> > delete homeworksessions where homeworkresult_id = @.homeworkresultId
> >> >
> >> > set @.NumDeleted=@.@.ROWCOUNT
> >> >
> >> > delete homeworkresults where homeworkresult_id=@.homeworkresultId
> >> >
> >> > set @.NumDeleted=@.NumDeleted + @.@.ROWCOUNT
> >>
> >>
> >>
>
>|||Closing the connection completely should roll back any open transactions but
you can use @.@.TRANCOUNT to see if there are any open trans on that
connection. If so issue a ROLLBACK and then close the connection.
--
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"Demi" <Demi@.discussions.microsoft.com> wrote in message
news:F9CBE982-C2AB-4770-8180-0F3EE272B04B@.microsoft.com...
> That's an interesting theory. We do have an overnight process kicked off
> from a http handler that runs for 30 minutes until the page timeout kicks
> in.
> The job has to run off hours and is essentially a processing loop so we
> limit how long it can go and it often doesn't have time to finish all
> items
> some days before the timeout. We have the database connection inside a
> "using" block so I figured the transaction in progress should be rolled
> back
> and the connection closed. Is there a possibility that this isn't always
> the
> case? If so is there anything we can really do in .NET to make the
> timeout
> clean up resources any more safely? Would catching ThreadAbortException
> and
> closing the connection explicitly help at all?
> We're not using a domain logon environment. This is coming from a
> webserver
> frontend.
> "Russell Fields" wrote:
>> Demi,
>> Perhaps you have an orphaned connection, as mentioned here:
>> http://support.microsoft.com/kb/137983/en-us
>> and at the end of this article:
>> http://support.microsoft.com/kb/224453/en-us
>> The solution offered for 2005 is the KILL command:
>> http://msdn2.microsoft.com/en-us/library/ms173730.aspx
>> Also, I have found that sometimes having the computer that made the
>> connection log off of the domain, and then log back in again, will alert
>> SQL
>> Server that all is not well with the existing transaction and it will
>> roll
>> back. (Kind of like it 'sees' the computer login, says to itself "Then
>> this
>> transaction must be junk", and throws it away.)
>> RLF
>> "Demi" <Demi@.discussions.microsoft.com> wrote in message
>> news:21C07BE7-E2F4-4A3F-B7D8-24D57C09DE10@.microsoft.com...
>> >
>> > Thanks. I will find out which statement, but it's going to be one
>> > delete
>> > statement or the other and both are trivial. Since this SP call is the
>> > head
>> > blocker I have no information that I can see about what made IT block.
>> > It
>> > has no parent blocker, it's just stuck. How can I proceed
>> > investigating?
>> >
>> > "Russell Fields" wrote:
>> >
>> >> Demi,
>> >>
>> >> I don't think that the CREATE PROCEDURE is blocking anything, but
>> >> someone
>> >> is
>> >> running this procedure and it is blocking on some internal step. If
>> >> you
>> >> are
>> >> getting this string from sys.dm_exec_sql_text you will need to look at
>> >> the
>> >> start and end offsets to see which statement in the procedure is
>> >> actually
>> >> running.
>> >>
>> >> You can get these from:
>> >>
>> >> select sql_handle, statement_start_offset, statement_end_offset from
>> >> sys.dm_exec_requests
>> >>
>> >> RLF
>> >>
>> >> "Demi" <Demi@.discussions.microsoft.com> wrote in message
>> >> news:9DDA2A4C-F1E3-47B1-B523-28ECD0CAEC3A@.microsoft.com...
>> >> >I don't understand why a CREATE PROC from 3.5 hours ago is the head
>> >> >blocker.
>> >> > The SP wasn't changed since in months so this must be a
>> >> > compile/recompile?
>> >> > It's not a COMPILE lock though but a PAGE lock. It's certainly not
>> >> > the
>> >> > initial creation. What else can be done to debug this? It's
>> >> > happening
>> >> > and
>> >> > usually resolving itself in 4-6 hours or if I kill the head blocker
>> >> > myself.
>> >> > It doesn't happen every day but almost every day.
>> >> >
>> >> > I've retrieved this info about the blocking from DMVStats and found
>> >> > similar
>> >> > info using my regular blocking info script also pulling info from
>> >> > DMV's.
>> >> >
>> >> > I'm running SQL 2005 SP2 Enterprise.
>> >> >
>> >> > statement started 6:35AM
>> >> > waiting statement (PAGE lock):
>> >> >
>> >> > insert into grades (blah,blah)
>> >> > select blah blah from homework join blah blah
>> >> >
>> >> > statement started at 3:01AM
>> >> > blocking statement: =============================================>> >> > -- Author: <Author,,Name>
>> >> > -- Create date: <Create Date,,>
>> >> > -- Description: <Description,,>
>> >> > -- =============================================>> >> > CREATE PROCEDURE [dbo].[ResultsHomeworkDelete]
>> >> > @.homeworkResultId int,
>> >> > @.NumDeleted int output
>> >> > AS
>> >> >
>> >> > delete homeworksessions where homeworkresult_id = @.homeworkresultId
>> >> >
>> >> > set @.NumDeleted=@.@.ROWCOUNT
>> >> >
>> >> > delete homeworkresults where homeworkresult_id=@.homeworkresultId
>> >> >
>> >> > set @.NumDeleted=@.NumDeleted + @.@.ROWCOUNT
>> >>
>> >>
>> >>
>>|||If the Server.ScriptTimeout expires while my SqlCommand.ExecuteNonQuery() is
running, "System.Web.HttpException: Request timed out" is thrown and my
connection is closed before the first line of the catch so the transaction is
not rolled back leaving an open transaction for that spid in Sql Server.
This is very bad and seems like a Framework bug.
try
{
if (_SqlConn == null)
{
_SqlConn = OpenConnection();
}
else if (_SqlConn.State == ConnectionState.Closed)
{
_SqlConn.Open();
}
// GetCommand creates a command and begins a transaction
using (SqlCommand cmd = GetCommand(_SqlConn))
{
if (_Timeout > 0)
cmd.CommandTimeout = _Timeout;
cmd.ExecuteNonQuery();
}
}
catch
{
HttpContext.Current.Trace.Write("DB", "Catch" + ((_SqlConn
== null) ? "no conn" : _SqlConn.State.ToString()));
// At first line in the catch the conn is closed
_SqlConn.State == Closed
// but the transaction is not rolled back
CloseConnection(); // this does a rollback if a transaction
exists, but the db connection is closed so the rollback doesn't work
}
"Andrew J. Kelly" wrote:
> Closing the connection completely should roll back any open transactions but
> you can use @.@.TRANCOUNT to see if there are any open trans on that
> connection. If so issue a ROLLBACK and then close the connection.
> --
> Andrew J. Kelly SQL MVP
> Solid Quality Mentors
>
> "Demi" <Demi@.discussions.microsoft.com> wrote in message
> news:F9CBE982-C2AB-4770-8180-0F3EE272B04B@.microsoft.com...
> >
> > That's an interesting theory. We do have an overnight process kicked off
> > from a http handler that runs for 30 minutes until the page timeout kicks
> > in.
> > The job has to run off hours and is essentially a processing loop so we
> > limit how long it can go and it often doesn't have time to finish all
> > items
> > some days before the timeout. We have the database connection inside a
> > "using" block so I figured the transaction in progress should be rolled
> > back
> > and the connection closed. Is there a possibility that this isn't always
> > the
> > case? If so is there anything we can really do in .NET to make the
> > timeout
> > clean up resources any more safely? Would catching ThreadAbortException
> > and
> > closing the connection explicitly help at all?
> >
> > We're not using a domain logon environment. This is coming from a
> > webserver
> > frontend.
> >
> > "Russell Fields" wrote:
> >
> >> Demi,
> >>
> >> Perhaps you have an orphaned connection, as mentioned here:
> >> http://support.microsoft.com/kb/137983/en-us
> >> and at the end of this article:
> >> http://support.microsoft.com/kb/224453/en-us
> >>
> >> The solution offered for 2005 is the KILL command:
> >> http://msdn2.microsoft.com/en-us/library/ms173730.aspx
> >>
> >> Also, I have found that sometimes having the computer that made the
> >> connection log off of the domain, and then log back in again, will alert
> >> SQL
> >> Server that all is not well with the existing transaction and it will
> >> roll
> >> back. (Kind of like it 'sees' the computer login, says to itself "Then
> >> this
> >> transaction must be junk", and throws it away.)
> >>
> >> RLF
> >>
> >> "Demi" <Demi@.discussions.microsoft.com> wrote in message
> >> news:21C07BE7-E2F4-4A3F-B7D8-24D57C09DE10@.microsoft.com...
> >> >
> >> > Thanks. I will find out which statement, but it's going to be one
> >> > delete
> >> > statement or the other and both are trivial. Since this SP call is the
> >> > head
> >> > blocker I have no information that I can see about what made IT block.
> >> > It
> >> > has no parent blocker, it's just stuck. How can I proceed
> >> > investigating?
> >> >
> >> > "Russell Fields" wrote:
> >> >
> >> >> Demi,
> >> >>
> >> >> I don't think that the CREATE PROCEDURE is blocking anything, but
> >> >> someone
> >> >> is
> >> >> running this procedure and it is blocking on some internal step. If
> >> >> you
> >> >> are
> >> >> getting this string from sys.dm_exec_sql_text you will need to look at
> >> >> the
> >> >> start and end offsets to see which statement in the procedure is
> >> >> actually
> >> >> running.
> >> >>
> >> >> You can get these from:
> >> >>
> >> >> select sql_handle, statement_start_offset, statement_end_offset from
> >> >> sys.dm_exec_requests
> >> >>
> >> >> RLF
> >> >>
> >> >> "Demi" <Demi@.discussions.microsoft.com> wrote in message
> >> >> news:9DDA2A4C-F1E3-47B1-B523-28ECD0CAEC3A@.microsoft.com...
> >> >> >I don't understand why a CREATE PROC from 3.5 hours ago is the head
> >> >> >blocker.
> >> >> > The SP wasn't changed since in months so this must be a
> >> >> > compile/recompile?
> >> >> > It's not a COMPILE lock though but a PAGE lock. It's certainly not
> >> >> > the
> >> >> > initial creation. What else can be done to debug this? It's
> >> >> > happening
> >> >> > and
> >> >> > usually resolving itself in 4-6 hours or if I kill the head blocker
> >> >> > myself.
> >> >> > It doesn't happen every day but almost every day.
> >> >> >
> >> >> > I've retrieved this info about the blocking from DMVStats and found
> >> >> > similar
> >> >> > info using my regular blocking info script also pulling info from
> >> >> > DMV's.
> >> >> >
> >> >> > I'm running SQL 2005 SP2 Enterprise.
> >> >> >
> >> >> > statement started 6:35AM
> >> >> > waiting statement (PAGE lock):
> >> >> >
> >> >> > insert into grades (blah,blah)
> >> >> > select blah blah from homework join blah blah
> >> >> >
> >> >> > statement started at 3:01AM
> >> >> > blocking statement: =============================================> >> >> > -- Author: <Author,,Name>
> >> >> > -- Create date: <Create Date,,>
> >> >> > -- Description: <Description,,>
> >> >> > -- =============================================> >> >> > CREATE PROCEDURE [dbo].[ResultsHomeworkDelete]
> >> >> > @.homeworkResultId int,
> >> >> > @.NumDeleted int output
> >> >> > AS
> >> >> >
> >> >> > delete homeworksessions where homeworkresult_id = @.homeworkresultId
> >> >> >
> >> >> > set @.NumDeleted=@.@.ROWCOUNT
> >> >> >
> >> >> > delete homeworkresults where homeworkresult_id=@.homeworkresultId
> >> >> >
> >> >> > set @.NumDeleted=@.NumDeleted + @.@.ROWCOUNT
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>|||I don't know what that line of code is actually doing but it can't really be
closing the connection or it would roll back. I assume you are using a
connection pool and this may have something to do with it. In any case I
would think the code should be such that it checks for open trans and rolls
them back if any are found before it closes the conn.
--
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"Demi" <Demi@.discussions.microsoft.com> wrote in message
news:6A00F3ED-9C0B-4E41-87EF-0DAEA200F600@.microsoft.com...
> If the Server.ScriptTimeout expires while my SqlCommand.ExecuteNonQuery()
> is
> running, "System.Web.HttpException: Request timed out" is thrown and my
> connection is closed before the first line of the catch so the transaction
> is
> not rolled back leaving an open transaction for that spid in Sql Server.
> This is very bad and seems like a Framework bug.
> try
> {
> if (_SqlConn == null)
> {
> _SqlConn = OpenConnection();
> }
> else if (_SqlConn.State == ConnectionState.Closed)
> {
> _SqlConn.Open();
> }
> // GetCommand creates a command and begins a transaction
> using (SqlCommand cmd = GetCommand(_SqlConn))
> {
> if (_Timeout > 0)
> cmd.CommandTimeout = _Timeout;
> cmd.ExecuteNonQuery();
> }
> }
> catch
> {
> HttpContext.Current.Trace.Write("DB", "Catch" + ((_SqlConn
> == null) ? "no conn" : _SqlConn.State.ToString()));
> // At first line in the catch the conn is closed
> _SqlConn.State == Closed
> // but the transaction is not rolled back
> CloseConnection(); // this does a rollback if a transaction
> exists, but the db connection is closed so the rollback doesn't work
> }
>
> "Andrew J. Kelly" wrote:
>> Closing the connection completely should roll back any open transactions
>> but
>> you can use @.@.TRANCOUNT to see if there are any open trans on that
>> connection. If so issue a ROLLBACK and then close the connection.
>> --
>> Andrew J. Kelly SQL MVP
>> Solid Quality Mentors
>>
>> "Demi" <Demi@.discussions.microsoft.com> wrote in message
>> news:F9CBE982-C2AB-4770-8180-0F3EE272B04B@.microsoft.com...
>> >
>> > That's an interesting theory. We do have an overnight process kicked
>> > off
>> > from a http handler that runs for 30 minutes until the page timeout
>> > kicks
>> > in.
>> > The job has to run off hours and is essentially a processing loop so we
>> > limit how long it can go and it often doesn't have time to finish all
>> > items
>> > some days before the timeout. We have the database connection inside a
>> > "using" block so I figured the transaction in progress should be rolled
>> > back
>> > and the connection closed. Is there a possibility that this isn't
>> > always
>> > the
>> > case? If so is there anything we can really do in .NET to make the
>> > timeout
>> > clean up resources any more safely? Would catching
>> > ThreadAbortException
>> > and
>> > closing the connection explicitly help at all?
>> >
>> > We're not using a domain logon environment. This is coming from a
>> > webserver
>> > frontend.
>> >
>> > "Russell Fields" wrote:
>> >
>> >> Demi,
>> >>
>> >> Perhaps you have an orphaned connection, as mentioned here:
>> >> http://support.microsoft.com/kb/137983/en-us
>> >> and at the end of this article:
>> >> http://support.microsoft.com/kb/224453/en-us
>> >>
>> >> The solution offered for 2005 is the KILL command:
>> >> http://msdn2.microsoft.com/en-us/library/ms173730.aspx
>> >>
>> >> Also, I have found that sometimes having the computer that made the
>> >> connection log off of the domain, and then log back in again, will
>> >> alert
>> >> SQL
>> >> Server that all is not well with the existing transaction and it will
>> >> roll
>> >> back. (Kind of like it 'sees' the computer login, says to itself
>> >> "Then
>> >> this
>> >> transaction must be junk", and throws it away.)
>> >>
>> >> RLF
>> >>
>> >> "Demi" <Demi@.discussions.microsoft.com> wrote in message
>> >> news:21C07BE7-E2F4-4A3F-B7D8-24D57C09DE10@.microsoft.com...
>> >> >
>> >> > Thanks. I will find out which statement, but it's going to be one
>> >> > delete
>> >> > statement or the other and both are trivial. Since this SP call is
>> >> > the
>> >> > head
>> >> > blocker I have no information that I can see about what made IT
>> >> > block.
>> >> > It
>> >> > has no parent blocker, it's just stuck. How can I proceed
>> >> > investigating?
>> >> >
>> >> > "Russell Fields" wrote:
>> >> >
>> >> >> Demi,
>> >> >>
>> >> >> I don't think that the CREATE PROCEDURE is blocking anything, but
>> >> >> someone
>> >> >> is
>> >> >> running this procedure and it is blocking on some internal step.
>> >> >> If
>> >> >> you
>> >> >> are
>> >> >> getting this string from sys.dm_exec_sql_text you will need to look
>> >> >> at
>> >> >> the
>> >> >> start and end offsets to see which statement in the procedure is
>> >> >> actually
>> >> >> running.
>> >> >>
>> >> >> You can get these from:
>> >> >>
>> >> >> select sql_handle, statement_start_offset, statement_end_offset
>> >> >> from
>> >> >> sys.dm_exec_requests
>> >> >>
>> >> >> RLF
>> >> >>
>> >> >> "Demi" <Demi@.discussions.microsoft.com> wrote in message
>> >> >> news:9DDA2A4C-F1E3-47B1-B523-28ECD0CAEC3A@.microsoft.com...
>> >> >> >I don't understand why a CREATE PROC from 3.5 hours ago is the
>> >> >> >head
>> >> >> >blocker.
>> >> >> > The SP wasn't changed since in months so this must be a
>> >> >> > compile/recompile?
>> >> >> > It's not a COMPILE lock though but a PAGE lock. It's certainly
>> >> >> > not
>> >> >> > the
>> >> >> > initial creation. What else can be done to debug this? It's
>> >> >> > happening
>> >> >> > and
>> >> >> > usually resolving itself in 4-6 hours or if I kill the head
>> >> >> > blocker
>> >> >> > myself.
>> >> >> > It doesn't happen every day but almost every day.
>> >> >> >
>> >> >> > I've retrieved this info about the blocking from DMVStats and
>> >> >> > found
>> >> >> > similar
>> >> >> > info using my regular blocking info script also pulling info from
>> >> >> > DMV's.
>> >> >> >
>> >> >> > I'm running SQL 2005 SP2 Enterprise.
>> >> >> >
>> >> >> > statement started 6:35AM
>> >> >> > waiting statement (PAGE lock):
>> >> >> >
>> >> >> > insert into grades (blah,blah)
>> >> >> > select blah blah from homework join blah blah
>> >> >> >
>> >> >> > statement started at 3:01AM
>> >> >> > blocking statement: =============================================>> >> >> > -- Author: <Author,,Name>
>> >> >> > -- Create date: <Create Date,,>
>> >> >> > -- Description: <Description,,>
>> >> >> > -- =============================================>> >> >> > CREATE PROCEDURE [dbo].[ResultsHomeworkDelete]
>> >> >> > @.homeworkResultId int,
>> >> >> > @.NumDeleted int output
>> >> >> > AS
>> >> >> >
>> >> >> > delete homeworksessions where homeworkresult_id =>> >> >> > @.homeworkresultId
>> >> >> >
>> >> >> > set @.NumDeleted=@.@.ROWCOUNT
>> >> >> >
>> >> >> > delete homeworkresults where homeworkresult_id=@.homeworkresultId
>> >> >> >
>> >> >> > set @.NumDeleted=@.NumDeleted + @.@.ROWCOUNT
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>|||I've created a simplified example with all the source. You need to run it
with compilation debug="false". I run a profiler trace as well looking at
all the transaction events. There's a begin but no end when the page
(script) timeout hits. If there's a sql timeout then the handling is fine,
but the page timeout results in bad behavior. You can confirm this by seeing
the open transaction for the spid that executed the statement.
Server.ScriptTimeout = 5;
using (SqlConnection connection = new
SqlConnection(ConfigurationManager.ConnectionStrings["default"].ConnectionString))
{
using (SqlCommand command = connection.CreateCommand())
{
SqlTransaction transaction = null;
command.CommandTimeout = 90;
try
{
connection.Open();
transaction = connection.BeginTransaction();
command.Transaction = transaction;
command.CommandText = "WAITFOR DELAY '00:00:10'";
command.ExecuteNonQuery();
transaction.Commit();
}
catch
{
transaction.Rollback();
throw;
}
finally
{
connection.Close();
}
}
}
"Andrew J. Kelly" wrote:
> I don't know what that line of code is actually doing but it can't really be
> closing the connection or it would roll back. I assume you are using a
> connection pool and this may have something to do with it. In any case I
> would think the code should be such that it checks for open trans and rolls
> them back if any are found before it closes the conn.
> --
> Andrew J. Kelly SQL MVP
> Solid Quality Mentors
>
> "Demi" <Demi@.discussions.microsoft.com> wrote in message
> news:6A00F3ED-9C0B-4E41-87EF-0DAEA200F600@.microsoft.com...
> >
> > If the Server.ScriptTimeout expires while my SqlCommand.ExecuteNonQuery()
> > is
> > running, "System.Web.HttpException: Request timed out" is thrown and my
> > connection is closed before the first line of the catch so the transaction
> > is
> > not rolled back leaving an open transaction for that spid in Sql Server.
> > This is very bad and seems like a Framework bug.
> >
> > try
> > {
> > if (_SqlConn == null)
> > {
> > _SqlConn = OpenConnection();
> > }
> > else if (_SqlConn.State == ConnectionState.Closed)
> > {
> > _SqlConn.Open();
> > }
> >
> > // GetCommand creates a command and begins a transaction
> > using (SqlCommand cmd = GetCommand(_SqlConn))
> > {
> > if (_Timeout > 0)
> > cmd.CommandTimeout = _Timeout;
> > cmd.ExecuteNonQuery();
> > }
> > }
> > catch
> > {
> > HttpContext.Current.Trace.Write("DB", "Catch" + ((_SqlConn
> > == null) ? "no conn" : _SqlConn.State.ToString()));
> > // At first line in the catch the conn is closed
> > _SqlConn.State == Closed
> > // but the transaction is not rolled back
> >
> > CloseConnection(); // this does a rollback if a transaction
> > exists, but the db connection is closed so the rollback doesn't work
> > }
> >
> >
> > "Andrew J. Kelly" wrote:
> >
> >> Closing the connection completely should roll back any open transactions
> >> but
> >> you can use @.@.TRANCOUNT to see if there are any open trans on that
> >> connection. If so issue a ROLLBACK and then close the connection.
> >>
> >> --
> >> Andrew J. Kelly SQL MVP
> >> Solid Quality Mentors
> >>
> >>
> >> "Demi" <Demi@.discussions.microsoft.com> wrote in message
> >> news:F9CBE982-C2AB-4770-8180-0F3EE272B04B@.microsoft.com...
> >> >
> >> > That's an interesting theory. We do have an overnight process kicked
> >> > off
> >> > from a http handler that runs for 30 minutes until the page timeout
> >> > kicks
> >> > in.
> >> > The job has to run off hours and is essentially a processing loop so we
> >> > limit how long it can go and it often doesn't have time to finish all
> >> > items
> >> > some days before the timeout. We have the database connection inside a
> >> > "using" block so I figured the transaction in progress should be rolled
> >> > back
> >> > and the connection closed. Is there a possibility that this isn't
> >> > always
> >> > the
> >> > case? If so is there anything we can really do in .NET to make the
> >> > timeout
> >> > clean up resources any more safely? Would catching
> >> > ThreadAbortException
> >> > and
> >> > closing the connection explicitly help at all?
> >> >
> >> > We're not using a domain logon environment. This is coming from a
> >> > webserver
> >> > frontend.
> >> >
> >> > "Russell Fields" wrote:
> >> >
> >> >> Demi,
> >> >>
> >> >> Perhaps you have an orphaned connection, as mentioned here:
> >> >> http://support.microsoft.com/kb/137983/en-us
> >> >> and at the end of this article:
> >> >> http://support.microsoft.com/kb/224453/en-us
> >> >>
> >> >> The solution offered for 2005 is the KILL command:
> >> >> http://msdn2.microsoft.com/en-us/library/ms173730.aspx
> >> >>
> >> >> Also, I have found that sometimes having the computer that made the
> >> >> connection log off of the domain, and then log back in again, will
> >> >> alert
> >> >> SQL
> >> >> Server that all is not well with the existing transaction and it will
> >> >> roll
> >> >> back. (Kind of like it 'sees' the computer login, says to itself
> >> >> "Then
> >> >> this
> >> >> transaction must be junk", and throws it away.)
> >> >>
> >> >> RLF
> >> >>
> >> >> "Demi" <Demi@.discussions.microsoft.com> wrote in message
> >> >> news:21C07BE7-E2F4-4A3F-B7D8-24D57C09DE10@.microsoft.com...
> >> >> >
> >> >> > Thanks. I will find out which statement, but it's going to be one
> >> >> > delete
> >> >> > statement or the other and both are trivial. Since this SP call is
> >> >> > the
> >> >> > head
> >> >> > blocker I have no information that I can see about what made IT
> >> >> > block.
> >> >> > It
> >> >> > has no parent blocker, it's just stuck. How can I proceed
> >> >> > investigating?
> >> >> >
> >> >> > "Russell Fields" wrote:
> >> >> >
> >> >> >> Demi,
> >> >> >>
> >> >> >> I don't think that the CREATE PROCEDURE is blocking anything, but
> >> >> >> someone
> >> >> >> is
> >> >> >> running this procedure and it is blocking on some internal step.
> >> >> >> If
> >> >> >> you
> >> >> >> are
> >> >> >> getting this string from sys.dm_exec_sql_text you will need to look
> >> >> >> at
> >> >> >> the
> >> >> >> start and end offsets to see which statement in the procedure is
> >> >> >> actually
> >> >> >> running.
> >> >> >>
> >> >> >> You can get these from:
> >> >> >>
> >> >> >> select sql_handle, statement_start_offset, statement_end_offset
> >> >> >> from
> >> >> >> sys.dm_exec_requests
> >> >> >>
> >> >> >> RLF
> >> >> >>
> >> >> >> "Demi" <Demi@.discussions.microsoft.com> wrote in message
> >> >> >> news:9DDA2A4C-F1E3-47B1-B523-28ECD0CAEC3A@.microsoft.com...
> >> >> >> >I don't understand why a CREATE PROC from 3.5 hours ago is the
> >> >> >> >head
> >> >> >> >blocker.
> >> >> >> > The SP wasn't changed since in months so this must be a
> >> >> >> > compile/recompile?
> >> >> >> > It's not a COMPILE lock though but a PAGE lock. It's certainly
> >> >> >> > not
> >> >> >> > the
> >> >> >> > initial creation. What else can be done to debug this? It's
> >> >> >> > happening
> >> >> >> > and
> >> >> >> > usually resolving itself in 4-6 hours or if I kill the head
> >> >> >> > blocker
> >> >> >> > myself.
> >> >> >> > It doesn't happen every day but almost every day.
> >> >> >> >
> >> >> >> > I've retrieved this info about the blocking from DMVStats and
> >> >> >> > found
> >> >> >> > similar
> >> >> >> > info using my regular blocking info script also pulling info from
> >> >> >> > DMV's.
> >> >> >> >
> >> >> >> > I'm running SQL 2005 SP2 Enterprise.
> >> >> >> >
> >> >> >> > statement started 6:35AM
> >> >> >> > waiting statement (PAGE lock):
> >> >> >> >
> >> >> >> > insert into grades (blah,blah)
> >> >> >> > select blah blah from homework join blah blah
> >> >> >> >
> >> >> >> > statement started at 3:01AM
> >> >> >> > blocking statement: =============================================> >> >> >> > -- Author: <Author,,Name>
> >> >> >> > -- Create date: <Create Date,,>
> >> >> >> > -- Description: <Description,,>
> >> >> >> > -- =============================================> >> >> >> > CREATE PROCEDURE [dbo].[ResultsHomeworkDelete]
> >> >> >> > @.homeworkResultId int,
> >> >> >> > @.NumDeleted int output
> >> >> >> > AS
> >> >> >> >
> >> >> >> > delete homeworksessions where homeworkresult_id => >> >> >> > @.homeworkresultId
> >> >> >> >
> >> >> >> > set @.NumDeleted=@.@.ROWCOUNT
> >> >> >> >
> >> >> >> > delete homeworkresults where homeworkresult_id=@.homeworkresultId
> >> >> >> >
> >> >> >> > set @.NumDeleted=@.NumDeleted + @.@.ROWCOUNT
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
>|||I have no idea what the Server.ScriptTimeout does when it fires. If it
doesn't fire the CATCH then it doesn't sound like something you don't want
to set. I think this might be better if you posted in the C# newsgroups to
see why the CATCH isn't firing. This isn't a SQL Server issue per say and C#
isn't my forte so I probably can't provide any more useful assistance.
--
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"Demi" <Demi@.discussions.microsoft.com> wrote in message
news:2D2C60B4-C724-4736-B5D7-FF967F48B956@.microsoft.com...
> I've created a simplified example with all the source. You need to run it
> with compilation debug="false". I run a profiler trace as well looking at
> all the transaction events. There's a begin but no end when the page
> (script) timeout hits. If there's a sql timeout then the handling is
> fine,
> but the page timeout results in bad behavior. You can confirm this by
> seeing
> the open transaction for the spid that executed the statement.
> Server.ScriptTimeout = 5;
> using (SqlConnection connection => new
> SqlConnection(ConfigurationManager.ConnectionStrings["default"].ConnectionString))
> {
> using (SqlCommand command => connection.CreateCommand())
> {
> SqlTransaction transaction = null;
> command.CommandTimeout = 90;
> try
> {
> connection.Open();
> transaction = connection.BeginTransaction();
> command.Transaction = transaction;
> command.CommandText = "WAITFOR DELAY '00:00:10'";
> command.ExecuteNonQuery();
> transaction.Commit();
> }
> catch
> {
> transaction.Rollback();
> throw;
> }
> finally
> {
> connection.Close();
> }
> }
> }
> "Andrew J. Kelly" wrote:
>> I don't know what that line of code is actually doing but it can't really
>> be
>> closing the connection or it would roll back. I assume you are using a
>> connection pool and this may have something to do with it. In any case I
>> would think the code should be such that it checks for open trans and
>> rolls
>> them back if any are found before it closes the conn.
>> --
>> Andrew J. Kelly SQL MVP
>> Solid Quality Mentors
>>
>> "Demi" <Demi@.discussions.microsoft.com> wrote in message
>> news:6A00F3ED-9C0B-4E41-87EF-0DAEA200F600@.microsoft.com...
>> >
>> > If the Server.ScriptTimeout expires while my
>> > SqlCommand.ExecuteNonQuery()
>> > is
>> > running, "System.Web.HttpException: Request timed out" is thrown and my
>> > connection is closed before the first line of the catch so the
>> > transaction
>> > is
>> > not rolled back leaving an open transaction for that spid in Sql
>> > Server.
>> > This is very bad and seems like a Framework bug.
>> >
>> > try
>> > {
>> > if (_SqlConn == null)
>> > {
>> > _SqlConn = OpenConnection();
>> > }
>> > else if (_SqlConn.State == ConnectionState.Closed)
>> > {
>> > _SqlConn.Open();
>> > }
>> >
>> > // GetCommand creates a command and begins a transaction
>> > using (SqlCommand cmd = GetCommand(_SqlConn))
>> > {
>> > if (_Timeout > 0)
>> > cmd.CommandTimeout = _Timeout;
>> > cmd.ExecuteNonQuery();
>> > }
>> > }
>> > catch
>> > {
>> > HttpContext.Current.Trace.Write("DB", "Catch" +
>> > ((_SqlConn
>> > == null) ? "no conn" : _SqlConn.State.ToString()));
>> > // At first line in the catch the conn is closed
>> > _SqlConn.State == Closed
>> > // but the transaction is not rolled back
>> >
>> > CloseConnection(); // this does a rollback if a
>> > transaction
>> > exists, but the db connection is closed so the rollback doesn't work
>> > }
>> >
>> >
>> > "Andrew J. Kelly" wrote:
>> >
>> >> Closing the connection completely should roll back any open
>> >> transactions
>> >> but
>> >> you can use @.@.TRANCOUNT to see if there are any open trans on that
>> >> connection. If so issue a ROLLBACK and then close the connection.
>> >>
>> >> --
>> >> Andrew J. Kelly SQL MVP
>> >> Solid Quality Mentors
>> >>
>> >>
>> >> "Demi" <Demi@.discussions.microsoft.com> wrote in message
>> >> news:F9CBE982-C2AB-4770-8180-0F3EE272B04B@.microsoft.com...
>> >> >
>> >> > That's an interesting theory. We do have an overnight process
>> >> > kicked
>> >> > off
>> >> > from a http handler that runs for 30 minutes until the page timeout
>> >> > kicks
>> >> > in.
>> >> > The job has to run off hours and is essentially a processing loop so
>> >> > we
>> >> > limit how long it can go and it often doesn't have time to finish
>> >> > all
>> >> > items
>> >> > some days before the timeout. We have the database connection
>> >> > inside a
>> >> > "using" block so I figured the transaction in progress should be
>> >> > rolled
>> >> > back
>> >> > and the connection closed. Is there a possibility that this isn't
>> >> > always
>> >> > the
>> >> > case? If so is there anything we can really do in .NET to make the
>> >> > timeout
>> >> > clean up resources any more safely? Would catching
>> >> > ThreadAbortException
>> >> > and
>> >> > closing the connection explicitly help at all?
>> >> >
>> >> > We're not using a domain logon environment. This is coming from a
>> >> > webserver
>> >> > frontend.
>> >> >
>> >> > "Russell Fields" wrote:
>> >> >
>> >> >> Demi,
>> >> >>
>> >> >> Perhaps you have an orphaned connection, as mentioned here:
>> >> >> http://support.microsoft.com/kb/137983/en-us
>> >> >> and at the end of this article:
>> >> >> http://support.microsoft.com/kb/224453/en-us
>> >> >>
>> >> >> The solution offered for 2005 is the KILL command:
>> >> >> http://msdn2.microsoft.com/en-us/library/ms173730.aspx
>> >> >>
>> >> >> Also, I have found that sometimes having the computer that made the
>> >> >> connection log off of the domain, and then log back in again, will
>> >> >> alert
>> >> >> SQL
>> >> >> Server that all is not well with the existing transaction and it
>> >> >> will
>> >> >> roll
>> >> >> back. (Kind of like it 'sees' the computer login, says to itself
>> >> >> "Then
>> >> >> this
>> >> >> transaction must be junk", and throws it away.)
>> >> >>
>> >> >> RLF
>> >> >>
>> >> >> "Demi" <Demi@.discussions.microsoft.com> wrote in message
>> >> >> news:21C07BE7-E2F4-4A3F-B7D8-24D57C09DE10@.microsoft.com...
>> >> >> >
>> >> >> > Thanks. I will find out which statement, but it's going to be
>> >> >> > one
>> >> >> > delete
>> >> >> > statement or the other and both are trivial. Since this SP call
>> >> >> > is
>> >> >> > the
>> >> >> > head
>> >> >> > blocker I have no information that I can see about what made IT
>> >> >> > block.
>> >> >> > It
>> >> >> > has no parent blocker, it's just stuck. How can I proceed
>> >> >> > investigating?
>> >> >> >
>> >> >> > "Russell Fields" wrote:
>> >> >> >
>> >> >> >> Demi,
>> >> >> >>
>> >> >> >> I don't think that the CREATE PROCEDURE is blocking anything,
>> >> >> >> but
>> >> >> >> someone
>> >> >> >> is
>> >> >> >> running this procedure and it is blocking on some internal step.
>> >> >> >> If
>> >> >> >> you
>> >> >> >> are
>> >> >> >> getting this string from sys.dm_exec_sql_text you will need to
>> >> >> >> look
>> >> >> >> at
>> >> >> >> the
>> >> >> >> start and end offsets to see which statement in the procedure is
>> >> >> >> actually
>> >> >> >> running.
>> >> >> >>
>> >> >> >> You can get these from:
>> >> >> >>
>> >> >> >> select sql_handle, statement_start_offset, statement_end_offset
>> >> >> >> from
>> >> >> >> sys.dm_exec_requests
>> >> >> >>
>> >> >> >> RLF
>> >> >> >>
>> >> >> >> "Demi" <Demi@.discussions.microsoft.com> wrote in message
>> >> >> >> news:9DDA2A4C-F1E3-47B1-B523-28ECD0CAEC3A@.microsoft.com...
>> >> >> >> >I don't understand why a CREATE PROC from 3.5 hours ago is the
>> >> >> >> >head
>> >> >> >> >blocker.
>> >> >> >> > The SP wasn't changed since in months so this must be a
>> >> >> >> > compile/recompile?
>> >> >> >> > It's not a COMPILE lock though but a PAGE lock. It's certainly
>> >> >> >> > not
>> >> >> >> > the
>> >> >> >> > initial creation. What else can be done to debug this? It's
>> >> >> >> > happening
>> >> >> >> > and
>> >> >> >> > usually resolving itself in 4-6 hours or if I kill the head
>> >> >> >> > blocker
>> >> >> >> > myself.
>> >> >> >> > It doesn't happen every day but almost every day.
>> >> >> >> >
>> >> >> >> > I've retrieved this info about the blocking from DMVStats and
>> >> >> >> > found
>> >> >> >> > similar
>> >> >> >> > info using my regular blocking info script also pulling info
>> >> >> >> > from
>> >> >> >> > DMV's.
>> >> >> >> >
>> >> >> >> > I'm running SQL 2005 SP2 Enterprise.
>> >> >> >> >
>> >> >> >> > statement started 6:35AM
>> >> >> >> > waiting statement (PAGE lock):
>> >> >> >> >
>> >> >> >> > insert into grades (blah,blah)
>> >> >> >> > select blah blah from homework join blah blah
>> >> >> >> >
>> >> >> >> > statement started at 3:01AM
>> >> >> >> > blocking statement:
>> >> >> >> > =============================================>> >> >> >> > -- Author: <Author,,Name>
>> >> >> >> > -- Create date: <Create Date,,>
>> >> >> >> > -- Description: <Description,,>
>> >> >> >> > -- =============================================>> >> >> >> > CREATE PROCEDURE [dbo].[ResultsHomeworkDelete]
>> >> >> >> > @.homeworkResultId int,
>> >> >> >> > @.NumDeleted int output
>> >> >> >> > AS
>> >> >> >> >
>> >> >> >> > delete homeworksessions where homeworkresult_id =>> >> >> >> > @.homeworkresultId
>> >> >> >> >
>> >> >> >> > set @.NumDeleted=@.@.ROWCOUNT
>> >> >> >> >
>> >> >> >> > delete homeworkresults where
>> >> >> >> > homeworkresult_id=@.homeworkresultId
>> >> >> >> >
>> >> >> >> > set @.NumDeleted=@.NumDeleted + @.@.ROWCOUNT
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>>

Monday, March 19, 2012

Odd behavior (Pagebreaks & Visibility)

I built a report, that displays several Subreports. Then a request came, if it wouldn't be possible, to build a switch to turn on/off a page break after each report.

Since RS doesn't support a fexible page break controlling (you can either set or not set a page break hardcoded), I got an idea for a workaround:

After my Subreport I put a rectangle with a page break. Now every Subreport was displayed on a separate page.

Then I set the visibility for the rectangle to "hidded" and as expected, there was no page break after each subreport.

So far, so good. I then created a boolean parameter and set the Visibility expression to:

=Not Parameters!PageBreakAfterEachReport.Value

Now here comes the strange thing: If the Parameter is false, the rectangle is not displayed and therefor there is no page break, BUT, if the parameter is true, the rectangle is displayed correctly but there is STILL NO page break!!!?!?!!?!?

Why does the page break work, when I set the visibility hardcoded, but not when I try to control it via a parameter & expression?

I'm having the same issue here. If my control's visibility is dynamic, the pagebreaks do not work correctly. Is there any resolution/workaround to this problem?|||

Hi,

You could load the xml generated in XmlDocument and then using Xpath select the pagebreak element. Set this element dynamically.

Regards,

Alok

|||

Folks, I don't know if it is going to make you feel better or not, but apparently this behavior is "currently by design" -- at least I think that what is described in this thread is the same as what you are discussing.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=672379&SiteID=1

Actually (editing this post) now that I think about it, I may already have worked out a workaround that will work for this situation. Let me know what you think.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1682115&SiteID=1

In that post, I included a special dummy group and used a boolean parameter to determine the conditional page break. In your case, rather than the parameter, your condition would be something "if my other thing isn't visible, do this page break".

Hope this makes sense...

>L<

Odd behavior (Pagebreaks & Visibility)

I built a report, that displays several Subreports. Then a request came, if it wouldn't be possible, to build a switch to turn on/off a page break after each report.

Since RS doesn't support a fexible page break controlling (you can either set or not set a page break hardcoded), I got an idea for a workaround:

After my Subreport I put a rectangle with a page break. Now every Subreport was displayed on a separate page.

Then I set the visibility for the rectangle to "hidded" and as expected, there was no page break after each subreport.

So far, so good. I then created a boolean parameter and set the Visibility expression to:

=Not Parameters!PageBreakAfterEachReport.Value

Now here comes the strange thing: If the Parameter is false, the rectangle is not displayed and therefor there is no page break, BUT, if the parameter is true, the rectangle is displayed correctly but there is STILL NO page break!!!?!?!!?!?

Why does the page break work, when I set the visibility hardcoded, but not when I try to control it via a parameter & expression?

I'm having the same issue here. If my control's visibility is dynamic, the pagebreaks do not work correctly. Is there any resolution/workaround to this problem?|||

Hi,

You could load the xml generated in XmlDocument and then using Xpath select the pagebreak element. Set this element dynamically.

Regards,

Alok

|||

Folks, I don't know if it is going to make you feel better or not, but apparently this behavior is "currently by design" -- at least I think that what is described in this thread is the same as what you are discussing.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=672379&SiteID=1

Actually (editing this post) now that I think about it, I may already have worked out a workaround that will work for this situation. Let me know what you think.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1682115&SiteID=1

In that post, I included a special dummy group and used a boolean parameter to determine the conditional page break. In your case, rather than the parameter, your condition would be something "if my other thing isn't visible, do this page break".

Hope this makes sense...

>L<

Wednesday, March 7, 2012

ODBC SQL SERVER .. data would be Truncated!

Hey everyone ..

i have a website going .. .. ofcourse you use the Ws-FTP to upload the
photos to the page .. and i have to use SQL program to insert the file
names and values into the Database ..

i have been doing this for the longest time .. ill show u an
example below ..

Insert INTO PHoto (FOLDER, PIC_NAME, TAKEN_FROM, TAKEN_DATE, MONTH_YEAR,
DISPLAY_FOLDER, MONTH_YEAR_ID) VALUES('PHOTO BLAH BLAH BLAH .. ..
basically all the values .. the name and dates etc.

been doin it for the longest time .. excute the line and it will give me
an OK .. and my photo will be up on the website! ..

i tried uploading some files today .. and i get this weird message!

[microsoft][ODBC SQL server Driver][Sql server]String or binary data
would be truncated.

and now i can't put anythin into the database cause everytime i try to
excute and put those files up .. it gives me that error!

can anyone help plz?

--
Posted via http://dbforums.comArabian143 (dani@.windsorsocial.com) writes:
> Insert INTO PHoto (FOLDER, PIC_NAME, TAKEN_FROM, TAKEN_DATE, MONTH_YEAR,
> DISPLAY_FOLDER, MONTH_YEAR_ID) VALUES('PHOTO BLAH BLAH BLAH .. ..
> basically all the values .. the name and dates etc.
>...
> [microsoft][ODBC SQL server Driver][Sql server]String or binary data
> would be truncated.

This means that some of the values you are trying to insert is longer
than the column has foom for. For instance, assume that FOLDER is
char(20), but you try to insert 'C:\some-folder\some-sub-folder\files'
which is more than 20 chars.

If you don't care about truncation, include the statement SET ANSI_WARNINGS
OFF, and SQL will truncate in silence and not raise an error.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||thanx alot for responding ..

do i set the line next to the lines that im executing .. or beside them
.. or do i just execute the ANSI_warning thing by it self ..

when do i use this command and how many times do i have to use it!

thanx ..

im sorry im kind of new to this so i need exact details


This means that some of the values you are trying to insert is longer

than the column has foom for. For instance, assume that FOLDER is

char(20), but you try to insert 'C:\some-folder\some-sub-folder\files'

which is more than 20 chars.

If you don't care about truncation, include the statement SET
ANSI_WARNINGS

OFF, and SQL will truncate in silence and not raise an error.

--

Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

--
Posted via http://dbforums.com|||hi again ..

i tried that line..

is said ok ..after i executed it ..

but i still got the same error after i tried to send a file to
the database!

im so lost man!

HELP!!!!!!!!!!!!!!!

This means that some of the values you are trying to insert is longer

than the column has foom for. For instance, assume that FOLDER is

char(20), but you try to insert 'C:\some-folder\some-sub-folder\files'

which is more than 20 chars.

If you don't care about truncation, include the statement SET
ANSI_WARNINGS

OFF, and SQL will truncate in silence and not raise an error.

--

Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

--
Posted via http://dbforums.com|||nevermind i got it working

thing had too many god damn values

it was a big value .. but i had to narrow it down

but u gave me the idea and i thank u ..

bye for now

--
Posted via http://dbforums.com