本文整理匯總了C#中Columns.load方法的典型用法代碼示例。如果您正苦於以下問題:C# Columns.load方法的具體用法?C# Columns.load怎麽用?C# Columns.load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Columns
的用法示例。
在下文中一共展示了Columns.load方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Table
public Table(Database database, string catalog, string schema, string name, string type, string remarks, string dial)
{
this.database = database;
this.catalog = catalog;
this.schema = schema;
this.name = name;
this.type = type;
this.remarks = remarks;
columns = new Columns(this);
columns.load();
primaryKey = new PrimaryKey(this);
primaryKey.load();
//foreignKey = new ForeignKey(this);
//foreignKey.load();
indexes = new Indexes(this);
triggers = new Triggers(this);
insert = new OdbcCommand();
//insert.CommandText = "insert into " + schema + "." + name;
insert.CommandText = "insert into " + name;
insert.CommandText += "(";
int ordinal = 0;
if (dial.ToUpper() == "DB2")
{
foreach (Column column in columns.Values)
{
if (ordinal != 0)
insert.CommandText += ",";
insert.CommandText += column.name;
ordinal++;
}
}
else
{
foreach (Column column in columns.Values)
{
if (ordinal != 0)
insert.CommandText += ",";
insert.CommandText += "[" + column.name + "]";
ordinal++;
}
}
insert.CommandText += ") values (";
insert.CommandType = CommandType.Text;
insert.Connection = database.connection;
ordinal = 0;
foreach (Column column in columns.Values)
{
if (ordinal != 0)
insert.CommandText += ",";
// ODBC does not support named parameters
//insert.CommandText += "@" + column.name;
insert.CommandText += "?";
ordinal++;
insert.Parameters.Add(column.parameter);
}
insert.CommandText += ")";
}