Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Handling date fields from Visual FoxPro
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01129644
Message ID:
01170717
Views:
11
Kevin,

FYI, this is what I did to get nullable dates to work:

The assignment in my grdSurveyDue_RowUpdating() :

this.oSurveyDue.Entity.Svd_PostDT = null;
// Is this how I should be doing the assignment after you showed me how to SetDataRow() yesterday? (Because my updates still affect the first row)

// Get the DataRow
DataRow CurrentRow = dsSurveyDue.Tables[this.oSurveyDue.TableName].Rows[e.RowIndex];

// Use the below to set the entity data row
this.oSurveyDue.Entity.SetDataRow(CurrentRow);

I changed the entity set/get:

public DateTime? Svd_PostDT
{
get { return (DateTime?)mmType.GetNullableDbValue(this.Row["Svd_PostDT"]); }
set { this.Row["Svd_PostDT"] = (value == null) ? mmType.GetEmptyDataValue("System.DateTime") : value; }
// 11/16/2006 TAG added GetEmptyDataValue() above
}

Thanks for all your help, Ted

>Ted,
>
>>When an SQL server column is nullable how do I set/update the entity column value to null?
>
>In the upcoming MM .ENT 2.3 We have changed nullable entity properties so this works properly. Here's an example of the new code:
>
>
this.Row["OrderDate"] = mmType.SetNullableDbValue(value);
>
>mmType.SetNullableDbValue is a new method that looks like this:
>
>
public static object SetNullableDbValue(object value)
>{
>	return (value == null) ? DBNull.Value : value;
>}
>
>For now, you can just change the Set() of the entity property to use similar logic as the SetNullableDbValue() method, or you can send me a private e-mail and I will get you a pre-release of the new version.
>
>Best Regards,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform