Ext.Net :SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM

  1. #1

    Ext.Net :SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM

    when I leave empty DateField and get the value of this emty field via button click event, i get the error like this SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.

    what I see while debugging ,it gets the value like this {01.01.0001 00:00:00}, what I wanna do is when It leave empty ,i get the Dbnull value or just null value thus I can insert to sqlserver this value.

    <ext:DateField ID="AlisTrh" runat="server" FieldLabel="Atrh" Type="Date" Format="dd-MM-yyyy"  Flex="1">
  2. #2
    How are you submitting the data?
  3. #3
    Quote Originally Posted by RCN View Post
    How are you submitting the data?
      BObj_Person person = new BObj_Person
                {
    ........
    .......
    MydateField= Helper_.ConvertNullDate(MydateField.SelectedDate),     //however in here I get the value  {01.01.0001 00:00:00},  
    .......
    ........
    
    }
    .......
    ........
    
     personel.Update(person );// in this section I insert the  persons values into Db. I also use DbNull.value inserting data 
    .................
    .......................
     public static DateTime? ConvertNullDate(DateTime? date)
            {
                return (date!=null) ? date : (DateTime?)null;
            }
  4. #4
    Please post a complete (but simplified) code sample demonstrating how to reproduce the issue.
  5. #5
    Quote Originally Posted by RCN View Post
    Please post a complete (but simplified) code sample demonstrating how to reproduce the issue.
    find the solition

    DateTime? d = null;    
    if (txtBirthDate.Text == string.Empty)
        objinfo.BirthDate = d;
    else
        objinfo.BirthDate =  DateTime.Parse(txtBirthDate.Text);
    but what I understand why , when the datetimefield is submited empty,"datetime ? date " field get the DateTime.MinValue; value ???
  6. #6
    Please try DateField's Value property.
  7. #7
    Quote Originally Posted by RCN View Post
    Please try DateField's Value property.
    can u give me a sample,how should I use it
  8. #8
    DateField _dt = new DateField { EmptyValue = new DateTime(1753, 1, 1, 12, 12, 00) };
    
    DateTime date = _dt.SelectedDate;
  9. #9
    Quote Originally Posted by RCN View Post
    DateField _dt = new DateField { EmptyValue = new DateTime(1753, 1, 1, 12, 12, 00) };
    
    DateTime date = _dt.SelectedDate;
    that doest make the date time value null,instead ,it insert a date like this 1753, 1, 1, 12, 12, 00

    what i wanna do ,if datefiels is emty ,insert it as a null value

Similar Threads

  1. [CLOSED] Panel´s title overflow
    By RCN in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 04, 2012, 6:21 PM
  2. How can I overflow ie outside the Viewport ?
    By ismailkocacan in forum 1.x Help
    Replies: 3
    Last Post: Aug 21, 2011, 3:38 PM
  3. [CLOSED] Panel Overflow
    By tiramisu in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Oct 18, 2010, 10:45 AM
  4. [CLOSED] [1.0] Toolbar Overflow
    By Ben in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 12, 2010, 3:02 PM
  5. [FIXED] [V0.7.0] Stack Overflow Bug
    By Timothy in forum Bugs
    Replies: 2
    Last Post: Oct 14, 2008, 6:11 PM

Tags for this Thread

Posting Permissions