Environment: VS.NET 2003; VB, Access 2003 database. The application allows
users to specify the path/filename and the table name at runtime.

I am trying to figure out how I can use a strongly typed dataset in this
environment. If I add an OleDBDataAdapter to my project and then create a
dataset from that the table name is embedded in the generated code. I
believe that changing the file/path is accomplished by making the connection
string use a variable that contains the user's path/filename but I am not
sure how to handle the fact that the table name changes at runtime.

Can anyone point me to some documentation or examples that will help me
understand how to do this?

--
------------------------------------
Wayne Wengert
wayne@wengert.org

Re: Using Strongly Typed Datasets by David

David
Mon Aug 18 12:00:53 CDT 2003


"Wayne Wengert" <wayne@wengert.org> wrote in message
news:u5FUTyZZDHA.1492@TK2MSFTNGP12.phx.gbl...
> Environment: VS.NET 2003; VB, Access 2003 database. The application allows
> users to specify the path/filename and the table name at runtime.
>
> I am trying to figure out how I can use a strongly typed dataset in this
> environment. If I add an OleDBDataAdapter to my project and then create a
> dataset from that the table name is embedded in the generated code. I
> believe that changing the file/path is accomplished by making the
connection
> string use a variable that contains the user's path/filename but I am not
> sure how to handle the fact that the table name changes at runtime.
>
> Can anyone point me to some documentation or examples that will help me
> understand how to do this?
>
> --

Just use the the DataAdapter.Fill(DataTable) overload.

eg
dim con as new oledbconnection("..." & someFile & "...")
con.open
Dim ds as new ds_MyTypedDataset
dim cmd as new OleDbCommand("select * from " & someTable,con)
dim da as new OleDbDataAdapter(cmd)
dim dt as DataTable = ds.MyTypedTableRows
da.Fill(dt)

David



Re: Using Strongly Typed Datasets by Wayne

Wayne
Mon Aug 18 13:18:39 CDT 2003

Wow - that's too easy. I assumed I'd have to do all sorts of tricks.

Thanks

Wayne
"David Browne" <davidbaxterbrowne no potted meat@hotmail.com> wrote in
message news:OJgOKpaZDHA.1640@TK2MSFTNGP10.phx.gbl...
>
> "Wayne Wengert" <wayne@wengert.org> wrote in message
> news:u5FUTyZZDHA.1492@TK2MSFTNGP12.phx.gbl...
> > Environment: VS.NET 2003; VB, Access 2003 database. The application
allows
> > users to specify the path/filename and the table name at runtime.
> >
> > I am trying to figure out how I can use a strongly typed dataset in this
> > environment. If I add an OleDBDataAdapter to my project and then create
a
> > dataset from that the table name is embedded in the generated code. I
> > believe that changing the file/path is accomplished by making the
> connection
> > string use a variable that contains the user's path/filename but I am
not
> > sure how to handle the fact that the table name changes at runtime.
> >
> > Can anyone point me to some documentation or examples that will help me
> > understand how to do this?
> >
> > --
>
> Just use the the DataAdapter.Fill(DataTable) overload.
>
> eg
> dim con as new oledbconnection("..." & someFile & "...")
> con.open
> Dim ds as new ds_MyTypedDataset
> dim cmd as new OleDbCommand("select * from " & someTable,con)
> dim da as new OleDbDataAdapter(cmd)
> dim dt as DataTable = ds.MyTypedTableRows
> da.Fill(dt)
>
> David
>
>



Re: Using Strongly Typed Datasets by Wayne

Wayne
Wed Aug 20 08:18:36 CDT 2003

After some experimenting I realized that this does not update the table name
used in the DELETE, INSERT and UPDATE strings.

Wayne

"David Browne" <davidbaxterbrowne no potted meat@hotmail.com> wrote in
message news:OJgOKpaZDHA.1640@TK2MSFTNGP10.phx.gbl...
>
> "Wayne Wengert" <wayne@wengert.org> wrote in message
> news:u5FUTyZZDHA.1492@TK2MSFTNGP12.phx.gbl...
> > Environment: VS.NET 2003; VB, Access 2003 database. The application
allows
> > users to specify the path/filename and the table name at runtime.
> >
> > I am trying to figure out how I can use a strongly typed dataset in this
> > environment. If I add an OleDBDataAdapter to my project and then create
a
> > dataset from that the table name is embedded in the generated code. I
> > believe that changing the file/path is accomplished by making the
> connection
> > string use a variable that contains the user's path/filename but I am
not
> > sure how to handle the fact that the table name changes at runtime.
> >
> > Can anyone point me to some documentation or examples that will help me
> > understand how to do this?
> >
> > --
>
> Just use the the DataAdapter.Fill(DataTable) overload.
>
> eg
> dim con as new oledbconnection("..." & someFile & "...")
> con.open
> Dim ds as new ds_MyTypedDataset
> dim cmd as new OleDbCommand("select * from " & someTable,con)
> dim da as new OleDbDataAdapter(cmd)
> dim dt as DataTable = ds.MyTypedTableRows
> da.Fill(dt)
>
> David
>
>