I am having a problem building a sqlDataAdapter in code which correctly tests for a null date in the concurrency check. The below method builds the command object I need. All the null tests work correctly except for the date. Anyone have any ideas why the date fails the check?
private SqlCommand adContactListUpdateCommand() { // Update Logic string sql = "UPDATE Contact " + "SET FirstName = @FirstName_New, " + "MiddleName = @MiddleName_New, " + "LastName = @LastName_New, " + "BirthDate = @BirthDate_New, " + "FamilyID = @FamilyID_New, " + "BusinessID = @BusinessID_New, " + "GroupID = @GroupID_New " + "WHERE ContactID = @ContactID " + "AND FirstName = @FirstName_Old " + "AND MiddleName = @MiddleName_Old " + "AND LastName = @LastName_Old " + "AND ( ( @BirthDate_Old IS NULL AND BirthDate IS NULL ) OR BirthDate = @BirthDate_Old ) " + "AND ( ( FamilyID IS NULL AND @FamilyID_Old IS NULL ) OR FamilyID = @FamilyID_Old ) " + "AND ( ( BusinessID IS NULL AND @BusinessID_Old IS NULL ) OR BusinessID = @BusinessID_Old ) " + "AND ( ( GroupID IS NULL AND @GroupID_Old IS NULL ) OR GroupID = @GroupID_Old )";
// Create Command SqlCommand cmd = new SqlCommand(sql, sqlCon);
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
The Grade of the Solution
The Zone Rank of the Expert Providing the Solution
The Number of Author and Expert Comments
The Number of Experts Contributing
The Feedback of the Community
Your Input Matters Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.
If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.