PowerTools SPREAD for Windows Forms 8.0J
GetChildRelation メソッド (IChildModelSupport)


子リレーションのインデックス
指定した位置の子データリレーション名を取得します。
構文
'Declaration
 
Function GetChildRelation( _
   ByVal index As Integer _
) As String
'使用法
 
Dim instance As IChildModelSupport
Dim index As Integer
Dim value As String
 
value = instance.GetChildRelation(index)
string GetChildRelation( 
   int index
)

パラメータ

index
子リレーションのインデックス

戻り値の型

データ リレーション名を含む String
次のサンプルコードは、指定したインデックスの子データリレーションの名前を返します。
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);
label1.Text = "The name of the child relation is " + s;
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 iModel As FarPoint.Win.Spread.Model.ISheetDataModel
Dim s As String
cModel = FpSpread1.ActiveSheet.Models.Data
s = cModel.GetChildRelation(0)
Label1.Text = "The name of the child relation is " & s
参照

IChildModelSupport インタフェース
IChildModelSupport メンバ

 

 


© 2004-2015, GrapeCity inc. All rights reserved.