MESCIUS SPREAD for ASP.NET 10.0J
GetDataColumnName メソッド (IDataSourceSupport)

列インデックス
指定した位置の列名を取得します。
構文
'Declaration
 
Function GetDataColumnName( _
   ByVal column As Integer _
) As String
string GetDataColumnName( 
   int column
)

パラメータ

column
列インデックス

戻り値の型

名前を含むString
次のサンプルコードは、モデルをデータセットに連結します。
string strConn  = "data source = 127.0.0.1;initial catalog=Pubs; integrated security = SSPI";
string sqlStr = "SELECT * FROM Authors; Select * From Titles";

System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(sqlStr, strConn);
DataSet ds = new DataSet();
da.Fill(ds);

FarPoint.Web.Spread.Model.IDataSourceSupport dss;
dss = (FarPoint.Web.Spread.Model.IDataSourceSupport)FpSpread1.ActiveSheetView.DataModel;
dss.AutoGenerateColumns = true;
dss.DataSource = ds;
dss.DataMember = "Table";
dss.DataKeyField = "auid";

string s;
s = dss.GetDataColumnName(2);
Response.Write("The column name is " + s);
Dim strConn As String = "data source = 127.0.0.1;initial catalog=Pubs; integrated security = SSPI"
Dim sqlStr As String = "SELECT * FROM Authors; Select * From Titles"

Dim da As New System.Data.SqlClient.SqlDataAdapter(sqlStr, strConn)
Dim ds As New DataSet
da.Fill(ds)

Dim dss As FarPoint.Web.Spread.Model.IDataSourceSupport
dss = FpSpread1.ActiveSheetView.DataModel
dss.AutoGenerateColumns = True
dss.DataSource = ds
dss.DataMember = "Table"
dss.DataKeyField = "auid"

Dim s As String
s = dss.GetDataColumnName(2)
Response.Write("The column name is " & s)
参照

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

 

 


© MESCIUS inc. All rights reserved.