I am using Report Viewer for my ASP.net application's reporting purpose.
The problem is, when I have data less than 50 characters in my table(DB is SQL Server) report works properly but when data goes beyond 50 characters it gives error as,
An error has occurred during report processing.
Cannot create a connection to data source 'DataSet1'.
Exception has been thrown by the target of an invocation.
Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
I cant't resolve the issue, PLease Help
thanks in advance
you can edit your dataset file with extension *.xsd with notepad
and then change maximum value for your column name/field name
example :
<xs:element name="InvDesc" msprop:Generator_ColumnVarNameInTable="columnInvDesc" msprop:Generator_ColumnPropNameInRow="InvDesc" msprop:Generator_ColumnPropNameInTable="InvDescColumn" msprop:Generator_UserColumnName="InvDesc">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="1000" />
</xs:restriction>
</xs:simpleType>
</xs:element>
i change maxlength from 50 to 1000
hope this will help you
Thank You
If you are using a TableAdapter:
Open Dataset and select the TableAdapter.
Select DataColumn giving this error and in the properties panel change the option MaxLength to the size you need
Related
I'm trying to send a quite simple JSON message from BizTalk.
{
"Value": 1
}
I set the type of the "Value" field to xs:int in my xml schema
<xs:element minOccurs="1" maxOccurs="1" name="Value" type="xs:int" />
But it keeps generating the wrong JSON message.
{
"Value": "1"
}
Not sure what I'm doing wrong here. Does anybody have some tips?
There can be multiple issues at work here.
Your XML payload is not going through a XML Dissasembler or Assembler before reaching the JSON Encoder, and hence the Message Type isn't set correctly, in which case it is not using the schema to determine the correct date types.
You have another earlier element in your schema with the same name but a different type. It will use the type from the first one for all elements with the same name. This was a bug in BizTalk 2013 R2, and I think it was still there in BizTalk 2016 and could cause some strange errors, especially if you had a Records (complex types) and Element (simple types) with the same name. e.g FIX: JSON encoder unable to handle XML schema with the same name for record and one of its elements in CU 7
Biztalk Embedded JSON Encoder has the ability to recognize schema of XML processed and should recognize xs:int value from schema and encoded without quotes.
But sometimes (as Sandro Pereira indicates even often) this encoder throws the error:
Reason: Value cannot be null.
Parameter name: key
That was my case. I had to use a custom JSON Encoder that recognizes XML datatype somehow.
My solution was:
Use this build of Newtonsoft.Json library that uses json:Type argument as indicator of XML tag datatype.
Create a custom JSON Encoder that uses the previous library
Create custom Complex Type in separate schema with targetNamespace = "http://james.newtonking.com/projects/json"
Note that attribute Type need to be Qualified
Import above schema in Your target schema using prefix json
Use this type as Data Structure Type and rename Your parameter.
Map this checking logical existance, to avoid putting argument without value or custom xslt tranform
Usefull sites:
Adding name to attribute
I am using asp.net sqldatasource connected to formview which has update parameter defined as string like such:
<UpdateParameters>
<asp:Parameter Name="C" Type="String" />
</UpdateParameters>
When I exceed 4000 characters I get "String truncation: max=4000..." error.
I am updating to SQL Compact Edition 4.0 and field is ntext.
I was able to put more than 4000 characters usign visual studio interface the problem seems not to be with the database field type or size.
Changing the parameter to:
<asp:Parameter Name="C" Type="String" size="5000" />
did not help. If I do this I get no errors but no more than 4000 characters get updated.
What could be limiting the update character size?
I ended up moving database update at code behind
Using connection As New SqlCeConnection(connstr)
Dim nonquerycommand As SqlCeCommand = connection.CreateCommand()
nonquerycommand.Parameters.Add("#c", SqlDbType.NText).Value = TheData
connection.Open()
nonquerycommand.CommandText = queryString
nonquerycommand.ExecuteNonQuery()
connection.Dispose()
End Using
I still wonder why I hit the 4000 character limit when I use SqlDatasource with asp:Parameter tag. Looking at the code, adding SqlDbType.NText parameter may be the issue. I could not add this on aspx page to the asp:Parameter tag.
I wish I could handle this on aspx page with SqlDataSource Update Parameters. But it wont work for updating more than 4000 Characters.
I have to make revisions on a number of projects so If there is an anwer to my initial question it will save me time. Although codebehind solution works for more than 4000 characters, I won't have to change for each project if sqldatasource in aspx page handles 4000+ characters - so help is appreciated.
I have a webpage that posts multiple form tags. It's an inline edit page, where I can either post one row at a time or multiple rows. Last night, without making any changes to the code or data, I started getting The URL-encoded form data is not valid error on multiple posts, although single row posts work fine.
The MS KB issue in question is: http://weblogs.asp.net/scottgu/archive/2011/12/28/asp-net-security-update-shipping-thursday-dec-29th.aspx
In a nutshell there is now an upper bound on the number of simultaneous HTTP form elements that may be posted. The default is now 1000 without explicitly changing it with this key in the <appSettings> portion of the web.config:
<add key="aspnet:MaxHttpCollectionKeys" value="some number greater than 1000" />
There was a microsoft update and it may have caused your issue see link.
http://knowledgebase.solarwinds.com/kb/questions/3476/Website+Error%3A+The+URL-encoded+form+data+is+not+valid
I'm writing a small ASP .Net application in order to retrieve data from a SQL database. The application uses drop downs in order to select what the next drop down should contain and when a page is selected, it should retrieve the HTML from the database. Everything is working until it gets to the retrival of the HTML data. When I try to retrieve the data, I get:
Microsoft JScript runtime error:
Sys.WebForms.PageRequestManagerServerErrorException:
An unknown error occurred while
processing the request on the server.
The status code returned from the
server was: 500
The HTML column is a defined as NVARCHAR(MAX), but I can't see this causing a problem. The application works if I set the DataValueField to another column. Has one else come across a problem like this? Maybe someone could shine some light on this?
One thing I noted when dealing with varchar(max) columns is that the framework still commonly expects to have a size associated with it. What I ended up having to do was specify the length as -1 to get it to accept a varchar(max) field. Your error message doesn't indicate that this is the problem, but you might try experimenting with it rather than turning off the validation, which could possibly have other repercussions.
Figured it out. Just needed to set ValidateRequest to false at the Page level.
Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
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: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
in jquery gird on button click i am displaying something like 28000 rows?
I know some of them are sujjested to define the JsonmaxLength in web config file.. but its not working for me>?
can anybody tell me about this?
thanks
Can you show us the entry in your web config?
Have you tried something like this?
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="500000">
</jsonSerialization>
</webServices>
</scripting>
</system.web.extensions>
more info here
i am displaying something like 28000 rows?
That sounds like a user interface nightmare to me. About the most rows you should ever think about presenting directly to a user at one time is 500. Anything beyond that and at best you're giving someone a false sense that they've seen a representative sample of your data.
Even paging is not a solution here unless you have a good sort. You should really have a search interface, aggregate it into a smaller set (think charts or graphs), or make it available for download in a format the user can open in a tool to help do real analysis on it (csv, excel, etc).