String or binary data would be truncated.
The statement has been terminated.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: String or binary data would be truncated.
I am getting this exception even after I did undo changes for the page, please someone help me to come out of this. *
You are trying to insert a data (string or binary) longer than the maximum length possible for the target field.
I agree with Morix Dev, your columndefintion is too small.
The exception dosnt report which column is too small. But you could log out the data before insert, and check them against the definition.
Related
When I attempt to export more then 5000 products to an excel file, I get this error.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:
System.Web.HttpException: Request timed out
I am logging the connection status events with the wcf relay, and I'm seeing something like this in the logs.
1/26 06:47:12 ERROR Service Bus ConnectionStatus: 'Reconnecting' Event. [(null)][42]
LastError: System.ServiceModel.CommunicationException: Exception of type 'System.ServiceModel.CommunicationException' was thrown. ---> Microsoft.ServiceBus.Messaging.Amqp.AmqpException: An AMQP error occurred (condition='amqp:unauthorized-access').
--- End of inner exception stack trace ---
This exception doesn't show up in the list on this microsoft page, and the only other post I can find anywhere related to this error message is here. However, that post does not have any recent comments or a resolution or workaround for the issue. Also, the exception doesn't have any stacktrace, so how am I supposed to troubleshoot this error?
I guess as a follow-up, I would ask whether this is anything to actually worry about if the wcf connection is never faulting.
Apparently, the token that the relay keeps refreshing to stay active requires the time on the server to match the azure service that it is connecting with, and if not, this type of error will show up. We were able to fix it by correcting the server time.
I am running an ASP website and connect to a SQL database, very standard setup. The connection string details are held in the <connectionStrings> tag of the web.config file.
If the database username/password details are not correct, I get an YSOD unhandled exception notice. This is not at all surprising, but I would like to show a custom error page instead. However, I cannot seem to get the custom page to show using <customErrors> settings.
It seems an unhandled exception at the web.config level (for example the incorrect database connection string) means the application does not get as far as redirecting to the custom error page.
Any advice on how to handle this exception would be much appreciated. I understand if the exception happened on a particular page I can add a try/catch to catch it. I am not sure where/how I can handle this exception:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user xxxxx
Find place where this connection string is used and handle exception there.
I am developing a Asp.net MVC web application and have been deploying to a web server for a few months now. Just recently I have experienced a new error that confused me. Upon publishing my application, and loading up the website, I get the following error message:
Sequence contains no elements
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Sequence contains no elements
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Sequence contains no elements]
System.Linq.Enumerable.First(IEnumerable`1 source) +514
System.Linq.Queryable.First(IQueryable`1 source) +330
LabSys.MvcApplication.Application_AuthorizeRequest(Object sender, EventArgs e) +1261
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&completedSynchronously) +165
I am very confused, because the application runs perfectly on localhost, without any issue or error message. I also checked my database, and it is also connected and validated to the server. So there should be no error.
Thanks for any help in advance!
Check in your code to make sure FirstOrDefault() or SingleOrDefault() is used instead of using any of these: First() or Single().
When you get theLINQ Error "Sequence contains no elements", this is
usually because you are using the First() or Single() command rather
than FirstOrDefault() and SingleOrDefault().
Sequence contains no elements?
I am getting the following error while using MySql with Entity framework. I have set the default connection timeout to 300000 on the connection string of EntityConnectionStringBuilder. How to resolve this in Entity framework?
Unhandled Exception: System.Data.EntityCommandExecutionException: An
error occurred while reading from the store provider's data reader. See the
inner exception for details. ---> MySql.Data.MySqlClient.MySqlException: Fatal
error encountered during data read. ---> MySql.Data.MySqlClient.MySqlException:
Reading from the stream has failed. ---> System.IO.EndOfStreamException: Attempted
to read past the end of the stream.
Update: How can we set net_read_timeout for ado.net entity framework?
Like this
data.Database.ExecuteSqlCommand("set net_write_timeout=99999; set net_read_timeout=99999");
what does the inner exception say?
Unhandled Exception: System.Data.EntityCommandExecutionException does not point to a timeout error, it could be something as simple as an int that needs to be nullable that is used in your EF query.
Could you give the query to?
Cheers