We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DataGrid Validatin with ADO

Thread ID:





98722 Mar 22,2011 05:02 PM UTC Mar 23,2011 01:51 PM UTC WPF 1
Tags: GridControl
Administrator [Syncfusion]
Asked On March 22, 2011 05:02 PM UTC


I'm having trouble implementing the IDataErrorInfo
while using an OledConnection.
How do I set up the property to return the column's value?

Here is my code:

public partial class MainWindow : Window
ObservableCollection collec = new ObservableCollection();
public MainWindow()

string file = @"..\..\sample.xls";
OleDbConnection oConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + file +";Extended Properties=\"Excel 8.0;HDR=YES;IMEX=1;\"");
OleDbCommand oCmd = new OleDbCommand("SELECT * FROM [Sheet1$]",oConn);
OleDbDataReader oReader = oCmd.ExecuteReader();

while (oReader.Read())
object[] rowValues = new object[oReader.FieldCount];
collec.Add(new Order {OrderID= Int32.Parse(rowValues[0].ToString()),CustomerID=rowValues[1].ToString(),EmployeeID=rowValues[2].ToString(),ShipName=rowValues[3].ToString(),ShipAddress=rowValues[4].ToString(),ShipCity=rowValues[5].ToString(),Freight=rowValues[6].ToString() });

dataGrid.ItemsSource = collec;

public class Order : System.ComponentModel.IDataErrorInfo
public int OrderID { get; set; }
public string CustomerID { get; set; }
public string EmployeeID { get; set; }
public string ShipName { get; set; }
public string ShipAddress { get; set; }
public string ShipCity { get; set; }
public string Freight { get; set; }

public string Error
get { return string.Empty; }

public string this[string columnName]
var result = string.Empty;
if (columnName == "OrderID")
//this doesn't work:
if(this.OrderID.Value =...

return result;



Rajasekar [Syncfusion]
Replied On March 23, 2011 01:51 PM UTC

Hi Assaf,

Thanks for choosing Syncfusion products.

The query posted in this forum is similar to this incident #78560. Regarding this query we have posted solution in the incident #78560. Please follow this incident for further clarification.

For Your Reference, please find the sample in the below location,

Sample:< http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GDC_Excel_OleDbConnection369360711.zip >

Please let us know if you have any queries.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon