Dataset Headaches

M

Matt MacDonald

Hi all,
First of all, I am not trying to be the guy who comes in here shouting his
mouth off at Microsoft. However, ever sinse I started using typed datasets
in VS2005 I have been fighting with a recurring issue.

I will have a project open and be working in it just fine, when all of a
sudden when I try to do something in my dataset (either add a new query,
modify and existing one, etc.) I get a big fat error box on my screen
telling me that it couldn't find the connection string. Nothing has been
changed (manually) in the project in regards to the connection strings,
either in the web.config or the application settings.

Probably about 70% of the time, I can just drag a new table in the dataset
from the data explorer and that recreates the "lost" connection and
everything is fine for now. However, the other 30% of the time, I will try
that and it may appear to work at a glance, but then suddenly my code has
about 80 errors in it because the class that should have been generated by
that dataset has a random error in it. In the latest case I get "Error 101
Custom tool error: Failed to generate code. Unable to convert input xml file
content to a DataSet. Requested value 'My' was not found. Requested value
'My' was not found."

OK, so now my only option other than trying to hunt down the elusive "My"
that it's looking for, is to pull up the latest backup and try to merge my
changes into that one back when the dataset was still working. After going
through all this effort to get back to where I already was, I just need to
look forward to it happening all over again sometime in the near future.

I can't believe that I'm the only one going through this and it seems like
by now, there really should be some sort of resolution. I really like what
you are able to do using typed datasets, and have been pushing them at my
company ever sinse I started using them, but somedays the aggravation they
cause makes me want to go back to just doing everything manually.

OK, so thanks for letting me vent. Again, I'm not trying to "blame" anyone
in particular, I'm just trying to get a resolution. Does anyone have any
suggestions?

Thanks,
Matt
 
M

Mr. Arnold

OK, so thanks for letting me vent. Again, I'm not trying to "blame"
anyone
in particular, I'm just trying to get a resolution. Does anyone have any
suggestions?

You can use a strong typed Collection of Data Objects that persist
themselves to the database.
 
M

Matt MacDonald

Mr. Arnold said:
You can use a strong typed Collection of Data Objects that persist
themselves to the database.

Thank you for your suggestion. That doesn't really solve the problem at
hand, because I can't really go back and re-do the projects I'm
currently working on, but I may consider that for the future.
 
M

Matt MacDonald

Mr. Arnold said:
You can use a strong typed Collection of Data Objects that persist
themselves to the database.

Thank you for your suggestion. That doesn't really solve the problem at
hand, because I can't really go back and re-do the projects I'm
currently working on, but I may consider that for the future.
 
M

Mr. Arnold

Matt MacDonald said:
Thank you for your suggestion. That doesn't really solve the problem at
hand, because I can't really go back and re-do the projects I'm
currently working on, but I may consider that for the future.

Visual Paradigm's NHibernate
 
J

Jim Rand

Hi Matt,

Rather than creating a dataset and dragging tables on to it with the VS 2005
designer, go back to the old VS 2003 method (using VS 2005) of

- Create a new component
- Drag your data adapters onto it
- Create a new dataset from the adapters.

This way, your dataset is independent of the underlying connection. It
really doesn't need a connection anyway. Just the adapters do.

I've heard that Microsoft is dropping this whole table adapter crap in VS
2008.

Jim
 
M

Matt MacDonald

Again, thanks for the suggestion, but I'm kind of past the point where I can
just start my whole data layer over again. I need to be able to fix what I
have.

Thanks,
Matt
 
S

sloan

I believe you've fallen into the "Rapid Development" trap.

The quick drag and drop stuff can eventually screw you.
As you're finding out.
The development is quick. Maintenance sucks. Do yourself a favor and
develop a true DAL from the beginning.
In the long run, it'll save you.

I'd suggest:
Create the dataset independant of any underlying table adapter.

See
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!140.entry
for my example.
 
M

Matt MacDonald

Actually, I was following the guidelines in MSDN for creating the DAL so I
don't think it's fair to say that I'm doing anything wrong, VS just keeps
hosing me. I have no problem with the maintenance, as long as VS will let
me do it. Again, I need a solution to my current situation, not a new way
to do it. Perhaps an MS VIP can chime in?
 
V

Vayse

I had a similar issue before. My post is at http://tinyurl.com/2p49qo
In my case, the issue was caused by copying a datatable from one xsd to
another. Once the problem occurs, there seems to be no way of fixing it.

I got tired of fixing the auto generated code, so in the end I just created
a new dataset. I let the wizard to most of the initial work, then pasted any
new tables one field at a time.
Likewise, I just copied the data adapter SQL statements - I made sure not to
copy the data adapter.
Even if you use Sourcesafe, like I do, restoring prior versions of the xsd
will not fix the project.

I've stuck to this technique since, and I get a lot less issues.
Not what you want to hear, I'm sure! However, it doesn't take that long once
you start. Plus you get stick with your current approach, no need to rewrite
the rest of the project.

Also, I'd recommend starting a brand new project - the connection string
seems to be stored in several places. Add your existing forms to the new
project. May seem a bit of paranoia , but better than going to all that
trouble and then finding the project still has problems.

Like you, I like using typed datasets, but it is a very fragile technology.
Vayse
 

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

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top