How do I generate a data adapter for a typed dataset?

K

Ken Varn

I have a typed DataSet in which I would like to generate a matching
DataAdapter. I tried using oleDBCommandBuilder class, but it does not seem
to create any table or column mappings. Is there someway to automatically
generate a DataAdapter that is matched up to a typed DataSet with all of the
table and column mappings built automatically from the typed DataSet?

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
 
W

William Ryan eMVP

The commandBuilder infers its logic from the select statement and I don't
believe there's any issue with using it with a typed dataset. You match the
CB to an Adapter and the mapping is done for you if the there's a select
statement and the table has a key. CommandBuilders are a bit lame though so
if you may want to use the DataAdapterConfiguration wizard or preferably you
can roll your own update logic. If you do this you'll have a lot better
control over concurrency and you can fine tune your update.

Bill Vaughn has a great article on this at www.betav.com ->Articles ->
MSDN ->Weaning developers from the commandbuilder.

Good luck,

Bill

--

W.G. Ryan, eMVP

http://forums.devbuzz.com/
http://www.knowdotnet.com/williamryan.html
http://www.msmvps.com/WilliamRyan/
 
K

Ken Varn

I looked into using the DataAdapterConfiguration wizard, but you can only
access it when you are putting a DataAdapter onto a form. Is there anyway
to get to the wizard outside of the form editor in VS.NET?

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
William Ryan eMVP said:
The commandBuilder infers its logic from the select statement and I don't
believe there's any issue with using it with a typed dataset. You match the
CB to an Adapter and the mapping is done for you if the there's a select
statement and the table has a key. CommandBuilders are a bit lame though so
if you may want to use the DataAdapterConfiguration wizard or preferably you
can roll your own update logic. If you do this you'll have a lot better
control over concurrency and you can fine tune your update.

Bill Vaughn has a great article on this at www.betav.com ->Articles ->
MSDN ->Weaning developers from the commandbuilder.

Good luck,

Bill

--

W.G. Ryan, eMVP

http://forums.devbuzz.com/
http://www.knowdotnet.com/williamryan.html
http://www.msmvps.com/WilliamRyan/
 
W

William Ryan eMVP

As stated you are correct, the wizard only works via the designer. If you
don't want to use the designer and aren't into commandbuilders or the method
Bill mentions at the link I sent you before , you can use a Template to
accomplish what you want, check out Miha Markic's site
http://www.rthand.com/Default.aspx?Page=2&SubPage=1 under the Generate Save
Adapter.

As an aside, it almost sounds like you are looking for an ORM tool if you
want something to automatically generate your data access logic... you may
want to take a loot at www.deklarit.com and/or LLBLGenPro, both of which
kick a33. We have a discussion forum on ORM here
http://forums.devbuzz.com/Using_OR/M_and_Code_Generators/forumid_28/tt.htm

Also. you may notice I mention Kathleen Dollard's new book on Code
Generation. She discusses this topic and ORM in Chapter 6 and it's a really
well done discussion.

Code generation is very cool and using templates like Miha illustrates is
another really neat technique. Even if you decide that it's not for you, I
think you'll be glad you looked into it if you check out his stuff,
Deklarit's product or Frans' stuff and/or Kathleen's book.
--

W.G. Ryan, eMVP

http://forums.devbuzz.com/
http://www.knowdotnet.com/williamryan.html
http://www.msmvps.com/WilliamRyan/
Ken Varn said:
I looked into using the DataAdapterConfiguration wizard, but you can only
access it when you are putting a DataAdapter onto a form. Is there anyway
to get to the wizard outside of the form editor in VS.NET?

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
William Ryan eMVP said:
The commandBuilder infers its logic from the select statement and I don't
believe there's any issue with using it with a typed dataset. You match the
CB to an Adapter and the mapping is done for you if the there's a select
statement and the table has a key. CommandBuilders are a bit lame
though
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top