主要目的是为了得到标题~~
TCmsColumn oColumn = new TCmsColumn(ColumnID);
oColumn.Select();
lblTitle.InnerText = oColumn.ColumnName;
调用构造函数,初始化表名字段名和传过来的编号
public TCmsColumn(string ID)
{
FTableName ="t_column";
FKeyName ="column_id";
FKeyValue = ID;
}
public override void Select()
{
string strSql= GetSelectString();
TSqlDB oDB= new TSqlDB(strSql);
if (!oDB.EOF)
{
FColumnID = oDB["column_id"].ToString();
FColumnName = oDB["column_name"].ToString();
}
oDB.Free();
}
string strSql= GetSelectString();得到SQL语句,就是刚才的初始化表名字段名和传过来的编号组合起来`~
TSqlDB oDB= new TSqlDB(strSql); 执得结果到DataSet
public TSqlDB(string Query)
{
FConnString= GetConnString();
Initial(Query);
}
以下是Initial(Query);:
private void Initial(string init_sql)
{
FConnection = new SqlConnection(FConnString);
FConnection.Open();
FCommand = new SqlCommand();
FCommand.Connection = FConnection;
FCommand.CommandText = init_sql;
FQueryString= init_sql;
FDataAdapter = new SqlDataAdapter();
FDataAdapter.SelectCommand = FCommand;
/ ataAdapter.TableMappings.Add("Table","v_DBUser");
FDataSet = new DataSet();
if (init_sql.Length>0)
FDataAdapter.Fill(FDataSet);
}
我最不明白的就是oDB["column_id"]取得什么值