One of the possible ways is to create a SQL-based table and a table view
based on that table. Then, create C1DataSetLogic objects (from the context
menu of C1SchemaDef) and wire to the BeforeGenerateSql event.
private void dataset_DataSet1_BeforeGenerateSql(object sender, C1.Data.GenerateSqlEventArgs e)
{
if (e.TableView.Name == "MyTableView")
{
e.Command = new OleDbCommand(
"SELECT TOP 5 Field1, Field2, Field3 FROM SomeTable",
(OleDbConnection)e.TableView.Diagram.Schema.Connections["Connection"].DbConnection);
e.Status = DataSetEventStatusEnum.Skip;
}
}
However, it may be more easier to use standard OleDbDataAdapter with custom SQL
statement for this purpose.
Regards,
2005年11月23日
归类于: ComponentOne — wildhope @ 10:22 am 评论(0)
2005年11月22日
Well, would it be possible to give 2/3 code snippets where you are using
> the new clone function to copy sheets from one book to another?
Sure, I hope this is enough:
c1XLBook1.Load(dlg.FileName);
C1XLBook cloneBook = CloneBook(this.c1XLBook1);
cloneBook.Save(dlg.FileName + "clone.xls");
private C1XLBook CloneBook(C1.C1Excel.C1XLBook book)
{
C1XLBook clone = new C1XLBook();
clone.Sheets.Clear();
foreach (XLSheet sheet in book.Sheets)
{
clone.Sheets.Add(sheet.Clone());
}
return clone;
}
归类于: ComponentOne — wildhope @ 10:04 pm 评论(0)