Datasets keep dissappearing from my WinForms

  • Thread starter Thread starter David Hearn
  • Start date Start date
D

David Hearn

I am dragging my SQL Server table onto my Windows form to create my
connection and adapter. I then go an generate my dataset and save
everything. When I build, I keep getting compile errors and if I
switch to code view and come back into design view or if I close the
form and re-open it, my dataset is gone. This is driving me nuts. I
can create a new project and drag the same table into it and
everything is fine. What am I missing?

Thanks in advance!
 
Hi David,

Which version of VS.NET are you using? What kind of error do you get? Could
you post exact steps which we could use to reproduce problem?
 
I am using VS.NET 2003, 1.1 Framework. I drag a table out of my SQL
Database from the Data Explorer onto the form which creates
SQLConnection1 and SQLDataAdapter1. So far, so good. Then, I generate
my dataset and it shows up in the try below the form right beside the
adapter and connection. As soon as I go and look at the form designer
generated code, i can notice that this line:

Friend WithEvents DsEmployee1 As Scheduling.dsEmployee

already has the Scheduling.dsEmployee underlined with the wavy line
telling me that there is something wrong with it. I switch back to
design mode and the dataset is missing.

Here is the error generated during compile:

Type 'Scheduling.dsEmployee' is not defined.

Like I said previously, I can start a new project and perform the same
steps and everything works. This is a project in which I already had
several forms built for but no previous data connections. Thanks for
any help in figuring this one out.
 
I have also had this problem. If Scheduling is the namespace for your
class, remove it. Then look at the designer. You should have the Dataset
back (at least untill the generated code is re-generated). For some reason
1.1 can't seem to find a dataset within the namespace it is defined in when
the fully qualified name is used. If that is not a bug I don'
 
Hi David,

I am not using the drag and drop anymore, but when I was using that,
sometimes some ghost code did stay in the desinger build code when I deleted
something.

Maybe you can check that.

Copr
 
Hi David,

Try deleting obj and bin folder of project and the open the project.
Does your form (that holds datasets) have some code in parameterless
constructor?
 
That did it Chuck. That was the problem. Although it should work with
the namespace so I would like to know why it's not. Also, when I
remove the namespace from one of the lines that is referenceing it, it
keeps trying to add it back. Anyone know why?

Thanks!
 
Ya, you are changing code inside a method reserved for vs. Any changes to
the design view will cause it to regenerate and there goes your 'fix'.

Chuck
 
Back
Top