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,


评论

该日志第一篇评论

发表评论

评论也有版权!