本文整理汇总了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 += ")";
}