Gets the number of child data relations.
Syntax
Visual Basic (Declaration) | |
---|
ReadOnly Property ChildRelationCount As Integer |
C# | |
---|
int ChildRelationCount {get;} |
Property Value
Integer number of child relations
Example
This example returns the number of child data relations.
C# | Copy Code |
---|
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;
int i;
cModel = (FarPoint.Win.Spread.Model.IChildModelSupport)fpSpread1.ActiveSheet.Models.Data;
i = cModel.ChildRelationCount;
label1.Text = "The number of child relatio is " + i; |
Visual Basic | Copy Code |
---|
Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data source= " & Application.StartupPath & "\Patients2000.mdb"
Dim sqlStr As String = "SELECT * FROM Patients"
Dim conn As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(conStr)
Dim ds As DataSet = New DataSet()
Dim daCust As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(sqlStr, conn)
daCust.Fill(ds, "Patients")
Dim daOrder As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(sqlStr, conn)
daOrder.Fill(ds, "Appointment")
Dim rel = New DataRelation("PatientRel", ds.Tables("Patients").Columns("LName"), ds.Tables("Appointment").Columns("LName"))
ds.Relations.Add(rel)
FpSpread1.DataSource = ds
Dim cModel As FarPoint.Win.Spread.Model.IChildModelSupport
Dim i As Integer
cModel = FpSpread1.ActiveSheet.Models.Data
i = cModel.ChildRelationCount
Label1.Text = "The number of child relations is " & i.ToString() |
Requirements
Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8
See Also