Miha
Wed Oct 04 03:53:46 CDT 2006
Rich,
You don't need to downcast from strongtyped dataset to generic one.
My guess is that you are using type while you should use an instance of that
dataset...
--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog:
http://cs.rthand.com/blogs/blog_with_righthand/
"Rich" <Rich@discussions.microsoft.com> wrote in message
news:6862FFF0-4DE3-4AA0-BA71-C48F5F723761@microsoft.com...
> Thank you all for your replies. I am using VB2005.
>
> I create a dataset manually, so in the solution explorer I have
> Dataset1.xsd. In the Datasources tab I have my Dataset1 and I add a table
> from the toolbox and add the columns manually - this way I can create an
> rdlc
> file for the Report viewer based on the persistent table. But I want to
> fill
> this table using a programmatic dataAdapter - not a TableAdapter from the
> toolbox. If I do this:
>
> Dim da As New sqlDataAdpater
> Dim ds As DirectCast(Dataset1 As Dataset)
>
> I get the blue squiggly line under DirectCast. I have tried different
> variations of
>
> Dim ds As MyProjectName.Dataset1
>
> But VisualStudio(2005) complains. Do I need to use a Namespace maybe? It
> seems like the form where I am trying to access Dataset1 just can't see
> it.
> So the question could be - how to make dataset1.xsd visible to my
> form/application?
>
> Thanks,
> Rich
>
> "Rich" wrote:
>
>> Hello,
>>
>> I created a dataset and dataTable in the designer (VB2005) as the
>> datasource
>> for a Reportviewer control. Up to now I have been creating
>> dataTables/datasets/dataAdapters on the fly at runtime. But I need to
>> set
>> field properties on the reportviewer at design time - could probably do
>> it at
>> run time - but too much code.
>>
>> So at run time I do this to fill a datatable on the fly
>> dim da As new sqldataAdapter
>> dim ds as new dataset
>> da.selectcommand = new sqlcommand
>> da.selectcommand.connection = conn
>> da.selectcommand.commantext = "select * from tbl1")
>> da.Fill(ds, "tblx")
>>
>> Now my dataset exists at design time along with the datatable. How do I
>> fill the existing datatable? the runtime code above complains if I
>> reference
>> the dataset/dataTable I created at design time. Any suggestions
>> appreciated.
>>
>> Thanks,
>> Rich