Showing posts with label exception. Show all posts
Showing posts with label exception. Show all posts

Friday, March 9, 2012

Decimal.MinValue throw OverflowException

I'm using Decimal.MinValue in SqlParameter( SqlDbType.Decimal ) to execute a stored procedure.

But, I receive this stack trace exception:

System.OverflowException: Conversion overflows.
at System.Data.SqlTypes.SqlDecimal.ToDecimal()
at System.Data.SqlTypes.SqlDecimal.get_Value()
at System.Data.SqlClient.TdsParser.AdjustDecimalScale(Decimal value, Int32 newScale)
at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

I have changed Decimal.MinValue to Decimal.Zero to resolve my trouble. But, Why Decimal.MinValue throw OverflowException? Isn't Decimal.MinValue valid SqlDbType.Decimal type?

From the online help:

The value of this constant is negative 79,228,162,514,264,337,593,543,950,335.

How many digits did you set the decimal database field to accept?

|||

Hi,

Please check if the decimal scale and precision are set correctly in both .NET and database.

The should be match, so the data conversion can work properly.

HTH. If this does not answer your question, please feel free to mark the post as Not Answered and reply. Thank you!

Friday, February 24, 2012

debugging script task

Hi,

I'm trying to debug a Script Task. I set a breakpoint then start debug. I always get a COM Exception error:

unhandled exception occurred in DTAttach.exe[3332]

File position not valid for new breakpoint

Can someone suggest me something?

Thanks

I have found this workaround

If you assign the result of an expression to a DTSVariable, I always get an error. If you assign the result to a varaible and then assign this variable to a dtsVariable all is fine.

e.g.

Dts.Variables("bFTPIsEmpty").Value = IIf(fs.GetFiles("*.*").Length = 0, True, False) --> ERROR

THIS WORKS FINE

IsEmpty = CBool(IIf(fs.GetFiles("*.*").Length = 0, True, False))

Dts.Variables("bFTPIsEmpty").Value = IsEmpty

|||

Was facing the same issue even after trying all of the above.

Have found workaround for this annoying problem

Everytime you get this error, right click on the problematic project in solution explorer and select 'clean' and then select 'rebuild'

Debugging should then work ok.

ta

arun

|||

I've tried both workarounds and nothing! I have not variables assignments so that it's not the issue for sure! I get this error after I choose debugger: An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Microsoft.SqlServer.ScriptTask.dll. Additional information: File position not valid for new breakpoint. Then I select to continue and the process ends correctly...

Just later I found that by commenting out this two declarations I had but not using, the problem went away!

Imports System.Xml

Imports System.Xml.XmlDataDocument

debugging script task

Hi,

I'm trying to debug a Script Task. I set a breakpoint then start debug. I always get a COM Exception error:

unhandled exception occurred in DTAttach.exe[3332]

File position not valid for new breakpoint

Can someone suggest me something?

Thanks

I have found this workaround

If you assign the result of an expression to a DTSVariable, I always get an error. If you assign the result to a varaible and then assign this variable to a dtsVariable all is fine.

e.g.

Dts.Variables("bFTPIsEmpty").Value = IIf(fs.GetFiles("*.*").Length = 0, True, False) --> ERROR

THIS WORKS FINE

IsEmpty = CBool(IIf(fs.GetFiles("*.*").Length = 0, True, False))

Dts.Variables("bFTPIsEmpty").Value = IsEmpty

|||

Was facing the same issue even after trying all of the above.

Have found workaround for this annoying problem

Everytime you get this error, right click on the problematic project in solution explorer and select 'clean' and then select 'rebuild'

Debugging should then work ok.

ta

arun

|||

I've tried both workarounds and nothing! I have not variables assignments so that it's not the issue for sure! I get this error after I choose debugger: An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Microsoft.SqlServer.ScriptTask.dll. Additional information: File position not valid for new breakpoint. Then I select to continue and the process ends correctly...

Just later I found that by commenting out this two declarations I had but not using, the problem went away!

Imports System.Xml

Imports System.Xml.XmlDataDocument

Sunday, February 19, 2012

Debugging Exception Errors in SQL Server Profiler

I have been having weird problems from my SQL Server, and decided to run a
trace. Well, I found my problem really fast, except I really don't know
what the problem is!
First off I am developing ASP apps for working with the DB, and this is
where the problem has arisen. It used to error me on my client machine, now
it just kind of locks up and acts like it is still running.
When I run trace on a page that I am developing, it gives me the following
error,
EventClass TextData
Exception Error: 207, Severity: 16, State: 3
A few lines above this entry is one that says Attention, but there is no
TextData or anything.
How do I find out where these problems are coming from?
Thanks,
Drew
From SQL BOL:
Error 207
Severity Level 16
Message Text
Invalid column name '%.*ls'.
Explanation
This error occurs when a column referenced in a Transact-SQL statement was
not found in any table specified in the FROM clause of the query
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Drew" <drew.laing@.NOswvtc.dmhmrsas.virginia.SPMgov> wrote in message
news:OZs5UH$yEHA.4044@.TK2MSFTNGP10.phx.gbl...
> I have been having weird problems from my SQL Server, and decided to run a
> trace. Well, I found my problem really fast, except I really don't know
> what the problem is!
> First off I am developing ASP apps for working with the DB, and this is
> where the problem has arisen. It used to error me on my client machine,
now
> it just kind of locks up and acts like it is still running.
> When I run trace on a page that I am developing, it gives me the following
> error,
> EventClass TextData
> Exception Error: 207, Severity: 16, State: 3
> A few lines above this entry is one that says Attention, but there is no
> TextData or anything.
> How do I find out where these problems are coming from?
> Thanks,
> Drew
>
|||Ok, I guess the question from here is, why doesn't it error out on the page?
Or at least show a generic error page. This error doesn't seem fatal, but
it won't show me a 404 page or anything... the progress bar at the bottom of
IE just keeps going up...
Have I disabled errors or somethign?
Thanks,
Drew
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:e0irCM$yEHA.824@.TK2MSFTNGP11.phx.gbl...
> From SQL BOL:
> Error 207
> Severity Level 16
> Message Text
> Invalid column name '%.*ls'.
> Explanation
> This error occurs when a column referenced in a Transact-SQL statement was
> not found in any table specified in the FROM clause of the query
> --
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Drew" <drew.laing@.NOswvtc.dmhmrsas.virginia.SPMgov> wrote in message
> news:OZs5UH$yEHA.4044@.TK2MSFTNGP10.phx.gbl...
> now
>
|||Also, If I try to run this page, with that error and then go to the server I
get this error,
"Unable to load SQL Server OLEDB Provider resource dll. The application
cannot continue."
Any ideas?
Thanks,
Drew
"Drew" <drew.laing@.NOswvtc.dmhmrsas.virginia.SPMgov> wrote in message
news:OpJtXQ$yEHA.2876@.TK2MSFTNGP12.phx.gbl...
> Ok, I guess the question from here is, why doesn't it error out on the
> page? Or at least show a generic error page. This error doesn't seem
> fatal, but it won't show me a 404 page or anything... the progress bar at
> the bottom of IE just keeps going up...
> Have I disabled errors or somethign?
> Thanks,
> Drew
>
> "Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
> news:e0irCM$yEHA.824@.TK2MSFTNGP11.phx.gbl...
>
|||See http://support.microsoft.com/kb/821535
From http://www.developmentnow.com/g/118_2004_11_0_0_479224/Debugging-Exception-Errors-in-SQL-Server-Profiler.htm
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com

Debugging Exception Errors in SQL Server Profiler

I have been having weird problems from my SQL Server, and decided to run a
trace. Well, I found my problem really fast, except I really don't know
what the problem is!
First off I am developing ASP apps for working with the DB, and this is
where the problem has arisen. It used to error me on my client machine, now
it just kind of locks up and acts like it is still running.
When I run trace on a page that I am developing, it gives me the following
error,
EventClass TextData
Exception Error: 207, Severity: 16, State: 3
A few lines above this entry is one that says Attention, but there is no
TextData or anything.
How do I find out where these problems are coming from?
Thanks,
DrewFrom SQL BOL:
Error 207
Severity Level 16
Message Text
Invalid column name '%.*ls'.
Explanation
This error occurs when a column referenced in a Transact-SQL statement was
not found in any table specified in the FROM clause of the query
--
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Drew" <drew.laing@.NOswvtc.dmhmrsas.virginia.SPMgov> wrote in message
news:OZs5UH$yEHA.4044@.TK2MSFTNGP10.phx.gbl...
> I have been having weird problems from my SQL Server, and decided to run a
> trace. Well, I found my problem really fast, except I really don't know
> what the problem is!
> First off I am developing ASP apps for working with the DB, and this is
> where the problem has arisen. It used to error me on my client machine,
now
> it just kind of locks up and acts like it is still running.
> When I run trace on a page that I am developing, it gives me the following
> error,
> EventClass TextData
> Exception Error: 207, Severity: 16, State: 3
> A few lines above this entry is one that says Attention, but there is no
> TextData or anything.
> How do I find out where these problems are coming from?
> Thanks,
> Drew
>|||Ok, I guess the question from here is, why doesn't it error out on the page?
Or at least show a generic error page. This error doesn't seem fatal, but
it won't show me a 404 page or anything... the progress bar at the bottom of
IE just keeps going up...
Have I disabled errors or somethign?
Thanks,
Drew
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:e0irCM$yEHA.824@.TK2MSFTNGP11.phx.gbl...
> From SQL BOL:
> Error 207
> Severity Level 16
> Message Text
> Invalid column name '%.*ls'.
> Explanation
> This error occurs when a column referenced in a Transact-SQL statement was
> not found in any table specified in the FROM clause of the query
> --
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Drew" <drew.laing@.NOswvtc.dmhmrsas.virginia.SPMgov> wrote in message
> news:OZs5UH$yEHA.4044@.TK2MSFTNGP10.phx.gbl...
>> I have been having weird problems from my SQL Server, and decided to run
>> a
>> trace. Well, I found my problem really fast, except I really don't know
>> what the problem is!
>> First off I am developing ASP apps for working with the DB, and this is
>> where the problem has arisen. It used to error me on my client machine,
> now
>> it just kind of locks up and acts like it is still running.
>> When I run trace on a page that I am developing, it gives me the
>> following
>> error,
>> EventClass TextData
>> Exception Error: 207, Severity: 16, State: 3
>> A few lines above this entry is one that says Attention, but there is no
>> TextData or anything.
>> How do I find out where these problems are coming from?
>> Thanks,
>> Drew
>>
>|||Also, If I try to run this page, with that error and then go to the server I
get this error,
"Unable to load SQL Server OLEDB Provider resource dll. The application
cannot continue."
Any ideas?
Thanks,
Drew
"Drew" <drew.laing@.NOswvtc.dmhmrsas.virginia.SPMgov> wrote in message
news:OpJtXQ$yEHA.2876@.TK2MSFTNGP12.phx.gbl...
> Ok, I guess the question from here is, why doesn't it error out on the
> page? Or at least show a generic error page. This error doesn't seem
> fatal, but it won't show me a 404 page or anything... the progress bar at
> the bottom of IE just keeps going up...
> Have I disabled errors or somethign?
> Thanks,
> Drew
>
> "Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
> news:e0irCM$yEHA.824@.TK2MSFTNGP11.phx.gbl...
>> From SQL BOL:
>> Error 207
>> Severity Level 16
>> Message Text
>> Invalid column name '%.*ls'.
>> Explanation
>> This error occurs when a column referenced in a Transact-SQL statement
>> was
>> not found in any table specified in the FROM clause of the query
>> --
>> --
>> Mike Epprecht, Microsoft SQL Server MVP
>> Zurich, Switzerland
>> IM: mike@.epprecht.net
>> MVP Program: http://www.microsoft.com/mvp
>> Blog: http://www.msmvps.com/epprecht/
>> "Drew" <drew.laing@.NOswvtc.dmhmrsas.virginia.SPMgov> wrote in message
>> news:OZs5UH$yEHA.4044@.TK2MSFTNGP10.phx.gbl...
>> I have been having weird problems from my SQL Server, and decided to run
>> a
>> trace. Well, I found my problem really fast, except I really don't know
>> what the problem is!
>> First off I am developing ASP apps for working with the DB, and this is
>> where the problem has arisen. It used to error me on my client machine,
>> now
>> it just kind of locks up and acts like it is still running.
>> When I run trace on a page that I am developing, it gives me the
>> following
>> error,
>> EventClass TextData
>> Exception Error: 207, Severity: 16, State: 3
>> A few lines above this entry is one that says Attention, but there is no
>> TextData or anything.
>> How do I find out where these problems are coming from?
>> Thanks,
>> Drew
>>
>>
>|||See http://support.microsoft.com/kb/821535
From http://www.developmentnow.com/g/118_2004_11_0_0_479224/Debugging-Exception-Errors-in-SQL-Server-Profiler.ht
Posted via DevelopmentNow.com Group
http://www.developmentnow.com

Debugging Exception Errors in SQL Server Profiler

I have been having weird problems from my SQL Server, and decided to run a
trace. Well, I found my problem really fast, except I really don't know
what the problem is!
First off I am developing ASP apps for working with the DB, and this is
where the problem has arisen. It used to error me on my client machine, now
it just kind of locks up and acts like it is still running.
When I run trace on a page that I am developing, it gives me the following
error,
EventClass TextData
Exception Error: 207, Severity: 16, State: 3
A few lines above this entry is one that says Attention, but there is no
TextData or anything.
How do I find out where these problems are coming from?
Thanks,
DrewFrom SQL BOL:
Error 207
Severity Level 16
Message Text
Invalid column name '%.*ls'.
Explanation
This error occurs when a column referenced in a Transact-SQL statement was
not found in any table specified in the FROM clause of the query
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Drew" <drew.laing@.NOswvtc.dmhmrsas.virginia.SPMgov> wrote in message
news:OZs5UH$yEHA.4044@.TK2MSFTNGP10.phx.gbl...
> I have been having weird problems from my SQL Server, and decided to run a
> trace. Well, I found my problem really fast, except I really don't know
> what the problem is!
> First off I am developing ASP apps for working with the DB, and this is
> where the problem has arisen. It used to error me on my client machine,
now
> it just kind of locks up and acts like it is still running.
> When I run trace on a page that I am developing, it gives me the following
> error,
> EventClass TextData
> Exception Error: 207, Severity: 16, State: 3
> A few lines above this entry is one that says Attention, but there is no
> TextData or anything.
> How do I find out where these problems are coming from?
> Thanks,
> Drew
>|||Ok, I guess the question from here is, why doesn't it error out on the page?
Or at least show a generic error page. This error doesn't seem fatal, but
it won't show me a 404 page or anything... the progress bar at the bottom of
IE just keeps going up...
Have I disabled errors or somethign?
Thanks,
Drew
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:e0irCM$yEHA.824@.TK2MSFTNGP11.phx.gbl...
> From SQL BOL:
> Error 207
> Severity Level 16
> Message Text
> Invalid column name '%.*ls'.
> Explanation
> This error occurs when a column referenced in a Transact-SQL statement was
> not found in any table specified in the FROM clause of the query
> --
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Drew" <drew.laing@.NOswvtc.dmhmrsas.virginia.SPMgov> wrote in message
> news:OZs5UH$yEHA.4044@.TK2MSFTNGP10.phx.gbl...
> now
>|||Also, If I try to run this page, with that error and then go to the server I
get this error,
"Unable to load SQL Server OLEDB Provider resource dll. The application
cannot continue."
Any ideas?
Thanks,
Drew
"Drew" <drew.laing@.NOswvtc.dmhmrsas.virginia.SPMgov> wrote in message
news:OpJtXQ$yEHA.2876@.TK2MSFTNGP12.phx.gbl...
> Ok, I guess the question from here is, why doesn't it error out on the
> page? Or at least show a generic error page. This error doesn't seem
> fatal, but it won't show me a 404 page or anything... the progress bar at
> the bottom of IE just keeps going up...
> Have I disabled errors or somethign?
> Thanks,
> Drew
>
> "Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
> news:e0irCM$yEHA.824@.TK2MSFTNGP11.phx.gbl...
>|||See http://support.microsoft.com/kb/821535
From http://www.developmentnow.com/g/118...er-Profiler.htm
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com

Tuesday, February 14, 2012

Deallocating cursor if exception occured.

Hi all,
i am facing one problem while executing stored procedure.
What i am doing is i am opening one cursor and then depending on values
fetch inside the cursor i am inserting data into one table.
But sometimes my insert query failes due to violation in primary key.
In that case sp is not directly stopping its execution.
So my question is if such situation occured how will i deallocate my
cursor. I am using sql server 2000.
How to handle such exception to execute next part of stored procedure.
Thanks in advance.
trialproduct2004@.yahoo.com wrote:
> Hi all,
> i am facing one problem while executing stored procedure.
> What i am doing is i am opening one cursor and then depending on values
> fetch inside the cursor i am inserting data into one table.
>
I suggest you do that with a WHERE clause rather than a cursor.
INSERT INTO tbl1 (co1, col2, ...)
SELECT col1, col2, ...
FROM tbl2
WHERE ... ?

> But sometimes my insert query failes due to violation in primary key.
> In that case sp is not directly stopping its execution.
Ditto. Better to fix your code rather than handle the errors it causes.
Change your INSERT query to avoid inserting duplicate rows.
Cursors should be a last resort only. At least 99.9% of the time you
can and should avoid them.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx