Hi Victor
> Hi,
> I have typed dataset (SQL Server
2000, database Northwind) with one data
> table with SelectComand:
dbo.CustOrdersDetail - StoredProcedure. It takes
> one parametr
@OrderId
>
> This dataset is source of C1DataViewSet. Of course I
can't use AutoFetch
> because C1DataViewSet is unable to fill data
without parameter @OrderId :-(
>
> Well, in Form.Load event I fill
BaseTable manually:
> Dim ta As New
NorthwindDataSetTableAdapters.CustOrdersDetailTableAdapter
>
ta.Fill(NorthwindDataSet.CustOrdersDetail, 10260)
>
> And
now
> C1DataViewSet1.Views(0).BaseTables(0).Rows.Count returns 4 BUT
> C1DataViewSet1.Views(0).Count is still 0.
>
> I think,
that in earlier versions of C1DataViewSet this works fine.
> (Now I use
C1DataExtender.2_2.0.20063.38)
Internally C1DataView operates in two modes -
database mode and in-memory mode. These modes are being selected automatically -
if all the base DataTables of the view has TableAdapters then view operates in
the database mode, which means that view performs a data fetching from a server
and doesn't show the rowset until the fetch will be performed.
If one of the base tables has no a TableAdapter
then view can't fetch a data from server and just exposes a rowset based on what
the base table rowsets contain - this case is referred to as in-memory mode, and
this is what you need.
Unfortunately C1DataView has no a public property
that allows manually select a necessary mode - I hope we'll add it in the
nearest future.
The only workaround I see for now is the following.
You may create a table (say CustOrdersDetailInMemory) in the DataSet with the
same structure as CustOrdersDetail, but without a TableAdapter, and define
C1DataView so as to represent the CustOrdersDetailInMemory. In run-time you fill
the CustOrdersDetail and copy its rows to
CustOrdersDetailInMemory:
foreach (DataRow row in
CustOrdersDetail)
CustOrdersDetailInMemory.Rows.Add(row.ItemArray);
You can't fill the CustOrdersDetailInMemory table
directly because of the CustOrdersDetailTableAdapter.Fill() method has typed
parameters. But in the same time the CustOrdersDetailTableAdapter class has the
private Adapter property, which returns a non-typed DbAdapter (see its
definition in the NorthwindDataSet.Designer.vb file). Because the
CustOrdersDetailTableAdapter class is defined as "partial", you may add the
public property (say PublicAdapter) in the custom part of NorthwindDataSet
(NorthwindDataSet.vb file) which just returns a value of the private Adapter
property, and use the PublicAdapter.Fill() method to fill the
CustOrdersDetailInMemory directly - this should work because Adapter is
non-typed and the structures of the tables are the same.
Thanks,
Alex