string conStr = "Provider=Microsoft.JET.OLEDB.4.0;data source= " + Application.StartupPath + "\\Patients2000.mdb";
string sqlStr = "SELECT * FROM Patients";
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(conStr);
DataSet ds = new DataSet();
System.Data.OleDb.OleDbDataAdapter daCust = new System.Data.OleDb.OleDbDataAdapter(sqlStr, conn);
daCust.Fill(ds, "Patients");
System.Data.OleDb.OleDbDataAdapter daOrder = new System.Data.OleDb.OleDbDataAdapter(sqlStr, conn);
daOrder.Fill(ds, "Appointment");
DataRelation rel = new DataRelation("PatientRel", ds.Tables["Patients"].Columns["LName"], ds.Tables["Appointment"].Columns["LName"]);
ds.Relations.Add(rel);
fpSpread1.DataSource = ds;
FarPoint.Win.Spread.Model.IChildModelSupport cModel;
FarPoint.Win.Spread.Model.ISheetDataModel iModel;
string s;
cModel = (FarPoint.Win.Spread.Model.IChildModelSupport)fpSpread1.ActiveSheet.Models.Data;
s = cModel.GetChildRelation(0);
iModel = cModel.GetChildDataModel(0, s);
label1.Text = "The number of rows in the child model is " + iModel.RowCount.ToString();