.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Compare validator type nvarchar

Posted By:      Posted Date: October 11, 2010    Points: 0   Category :ASP.Net

Hello  i am using sql datasource to fill my 2 dropdownlist 


first dropdownlist1                                  Second Dropdownlist2

       week1                                                    week1

       week2                                                    week2


View Complete Post

More Related Resource Links

Bug: Does not change column type from nvarchar to ntext


Scenario: If you create a table with a column of type nvarchar, populate it with some content and try to modify it using the WebMatrix editor, from nvarchar to ntext, it does not display any error message or warning that this is not possible. It silently saves and reverts the change, back to nvarchar. Wasted some hours on this issue as I thought my column was ntext, but in fact was still nvarchar.

Expected behavior: It should change to ntext, or if SQL CE doesn't support that, it should notify the user that no change was applied.

Conversion Failed when Converting the nvarchar value 'N' to data type int.

Hi.. I am facing a strange situation. when i executing the following query it is returning the error SELECT  s.row_id as shipment,    SUM(CAST(la5.attr_value AS INT)) AS Cases     FROM    shipment s WITH(NOLOCK)    INNER JOIN shipping_shift ss WITH(NOLOCK) ON s.shipping_shift = ss.row_id    INNER JOIN shift WITH(NOLOCK) ON ss.shift_id = shift.shift_id    INNER JOIN shipment_lot sl WITH(NOLOCK) ON s.po_id = sl.po_id AND s.cust_id = sl.cust_id AND          s.so_line_no = sl.so_line_no and s.ship_date_local = sl.ship_date_local     INNER JOIN lot_attr la5 WITH(NOLOCK) ON sl.lot_no = la5.lot_no AND sl.item_id = la5.item_id AND la5.attr_id = (SELECT attr_id FROM attr WITH(NOLOCK) WHERE attr_desc = 'CaseQty' AND attr_grp = 3)  WHERE s.spare2 = 'RELEASED'       AND shift.shift_desc = 'c'   AND DAY(ss.production_date) = DAY('2010-08-09 00:00:00.000')    AND MONTH(ss.production_date) = MONTH('2010-08-09 00:00:00.000')    AND YEAR(ss.production_date) = YEAR('2010-08-09 00:00:00.000') GROUP BY s.row_id  Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the nvarchar value 'N' to data type int. The column  type of attr_value of lot_attr table is a USER D

Set up a validator that compare the value of the current field with an other (using Dynamic Data)

Hi! Most of it is in the title : I'd like have a validator on the DateTime_Edit template for example that allows to compare this field with an other DateTime field. My problem is when I am in the DateTime_Edit template of my "master field" (the one I want to check), how can I access to the other field given the architecture of Dynamic Data FieldTemplates? But perhaps I'm not thinking in a good way on this control. Any advice will be welcome. Thanks Raphaelp

perand type clash: nvarchar(max) is incompatible with image

in sql2005 how to add a hex string to an image field.here imageHx is image field and @ImgHex is nvarchar(max) field.i am getting error likeperand type clash: nvarchar(max) is incompatible with imageupdate #TmpCamRep set ImageHX=(@ImgHex)

Error converting data type nvarchar to numeric.

i create a form using form view tools in asp.net..when i click insert command it shows error..this is code which i use for InsertCommand:<asp:SqlDataSource ID="SqlDataSourceFormView" runat="server"         ConnectionString="<%$ ConnectionStrings:AED_PanasonicConnectionString2 %>"         SelectCommand="SELECT * FROM [Debtor]"        InsertCommand="INSERT INTO Debtor (CompanyName, Desc2, RegisterNo, Address1, Address2, Address3, Address4, PostCode)VALUES (@CompanyName, @Desc2, @RegisterNo, @Address1, @Address2, @Address3, @Address4, @PostCode)">        </asp:SqlDataSource>Error:-Error converting data type nvarchar to numeric.where i have to make changes?

How to use compare validator with dd/MM/yyyy format of date

Hi all,  I have a form of leave application that has 2 dates, start date and end date. now i'm using the dd/MM/yyyy format for the date entry and i need to Validate end date like end date must me greater than or equal to start date. i want to do that with compare validator but its not working properly because of the Date  formats controls are using.    Currently i'm using textbox with Calendar extender ajax toolkit control.    So please help me if anybody have some hints.    Thanks in advance.

Error converting data type nvarchar to datetime.

hi all, I simply explain my application.plz try to understand. In my applicationi want to generate one complaint id.one customer may give two or more complaints at a time.suppose,he give two or more pnr numbers and their status and prioirty may differs.for this complaint i need to generate one common complaint id.how it is possible..?with some constant rows. am getting error in Class File near CLUser_Logged_DTClass File using System; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.SqlClient; using System.Web.Configuration; /// <summary> /// Summary description for BalComplaints /// </summary> public class BalComplaints { public BalComplaints() { // // TODO: Add constructor logic here // } int SNo, Complaint_Type_ID, Caller_Type_ID, No_of_Articles, Article_ID, CLPriority_ID, Status_ID, Origin_ID, Destination_ID; public int SNo1 { get { return SNo; } set { SNo = value; } } public int Caller_Type_ID1 { get { return Caller_Type_ID; } set { Caller_Type_ID = value; } } public int Destination_ID1 { get { return Destination_ID; } set { Destination

Text was truncated with "nvarchar(max)" data type and size by using SSIS Import and Export Wizar



I am using SSIS Import and export Wizar to load data from Excel file, I have set the datatype as "nvarchar(max); those data are not biger than 1000 bits but was failed to transfer as the error says:

[Source - TreatmentPlans$ [1]] Error: The "output column "SchoolPlan" (57)" failed because truncation occurred, and the truncation row disposition on "output column "SchoolPlan" (57)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.

Error converting data type nvarchar to numeric in Store Procedure execution



When I execute a Store Procedure via 'EXEC sp_XXX @p1, @p2' I'm getting this error 'Error converting data type nvarchar to numeric'.

After diggin into the TSQL code I have found that there's a field (type: nvarchar(200)) breaking the execution and resulting on the error.

If I query the table and the specified field with the same parameters as the Store Procedure the results are ok! If I execute the same code as the Store Procedure with the same parameters values the results are ok. The error only happens when executing the Store Procedure.

Any idea ?

Thanks in advance,

Gustavo Brian


If I cast the field to a smaller size value, as nvarchar(80), it works, but of course with data truncation.


Compare Validator not displaying message after postback


Hi all,

I have compare validators that I build on the fly in code behind that validate textboxes that are also built up in the code behind:

CompareValidator CV = new CompareValidator();
CV.ID = "CV" + parameter.Name;
CV.Type = ValidationDataType.Date;
CV.Operator = ValidationCompareOperator.DataTypeCheck;
CV.ErrorMessage = "* Invalid date";
CV.Display = ValidatorDisplay.Static;
CV.ControlToValidate = parameter.Name;
CV.ValidationGroup = "valGroup1";
CV.Style["font"] = "Arial";
CV.Style["color"] = "Red";
CV.Style["font-size"] = "10px";
CV.EnableClientScript = true;


These work fine until a postback occurs. After a postback they still validate the form (i.e. they don't let you postback) but the error message won't display. Can anybody please help?




i m facing the Problem for this getting an error like this


pls clear my error


CREATE PROCEDURE [dbo] . [UserDepositDetails_SPIns]

-- Add the parameters for the stored procedure here ( @regid int ,


System.Data.SqlClient.SqlException: Error converting data type nvarchar to datetime.


 Hi All,

I have recently moved a ASP.NET webserver from windows XP to
windows server 2008.
The website runs fine apart from anywhere that pulls a date
or uses the date from a JS date picker etc.

The error I am receiving is:

System.Data.SqlClient.SqlException: Error converting data type nvarchar to datetime.

Source Error:

Line 79:         cmd1.Parameters.AddWithValue("@EndDate", lblSearch2.Text);
Line 80:         conn.Open();
Line 81:         SqlDataReader reader = cmd1.ExecuteReader();
Line 82:         if (reader.HasRows)
Line 83:         {

Source File: c:\inetpub\wwwroot\folderx\pagex.aspx.cs    Line: 81

Stack Trace:

[SqlException (0x80131904): Error converting data type nvarchar to datetime.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1951450
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4849003
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject s

Compare validator /Range validator does not work while using localization



I have a requirement of converting existing english form to multi lingual form.I am currently converting english form to spanish form.

Everything works except the date formats.

The range validator is not working in a spanish form but works in a english form.

I have set the maximum and minimum value in page load as below in the english form

Heres how i have set the values

rndateval.MinimumValue = DateTime.Now.AddYears(-50).ToShortDateString();

rndateval.MaximumValue = DateTime.Now.AddDays(20).ToShortDateString();

But the range validator does not work

Please help me in resolving the issue .

Compare validator in a Gridview EditItemTemplate


I am trying to use a compare validator in the EditItemTemplate for the Gridview.

I would like to set the Maximum value for the validator at runtime e.g. Page_Load


Is there a way to set the Maximum value for a "Template field" dynamically at load time


Snippet of code:

 <asp:TemplateField HeaderText="Birth Year" SortExpression="MemberBirthYear">
                           <asp:TextBox ID="eitMemberBirthYear" runat="server" CssClass="eitField"
                              Text='<%# Bind("MemberBirthYear") %>' Width="60px"></asp:TextBox>
                           <asp:RequiredFieldValidator ID="Re

Compare Validator Problem?



I would like to compare a textbox against a value. I want to show validatorcalloutextender if value in Textbox lessthan specific value in validator.Here is the code:

<asp:CompareValidator ID="CompareValidator3" runat="server" ControlToValidate="TextBox2"
            Type="Double" ValueToCompare="1" Text='<img src="Images/validation_error.png">'

Error converting data type nvarchar to int


I've got a very simple report (using Employees table in Northwind) that I'm using an INT (EmployeesID) as the parameter. (Query Failed for Dataset1)

it works fine if I choose only one item from the list - but I'm allowing Multiple values, but when I actually choose multiple values, I get the error that's in the subject line.

My sProc to get the Employees from the ManagerID (which is actually the EmployeeID - list of employees) .Here's the code:


Select Emp.EmployeeID,
.Firstname +

Compare Validator

I am using Compare Validator for Comparing Dates. But it doesn't work for MM/dd/yyyy format. It works for dd/MM/yyyy. Why so, as the US format for date is "MM/dd/yyyy" ? Also SQL Server saves dates in MM/dd/yyyy format by default. And why compare validator is working for dd/MM/yyyy? It should not work in both cases or it should work in both cases. Don't you think it should be fixed? Why to waste time for making Custom Validator?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend