Re: ADO generated code disapears

From: dan (dea_at_deamon.com)
Date: 08/24/04


Date: Tue, 24 Aug 2004 09:40:57 +0100

I am using VS.net and VB.net.
> Are you using the Data Adapter Configuration wizard to generate the
> SqlDataAdapter and SqlCommand objects?
Yes, the code is generated and works fine. Until I need to make a change in
the form's design.
I compile and execute. During execution new exceptions are thrown most of
them of the format: "SqlParameter with ParameterName
 '@<parameter name>' is not contained by this SqlParameterCollection".
Indeed, all ".parameters.add" statements are no more present in the program.
This happened three times and I am absolutely sure I didn't delete those
lines.

Thanks, Dan

"William (Bill) Vaughn" <billvaRemoveThis@nwlink.com> wrote in message
news:ultstQWiEHA.396@TK2MSFTNGP12.phx.gbl...
> There are no "Data" controls in ADO.NET (there is a Data control in VB6).
> Are you using the Data Adapter Configuration wizard to generate the
> SqlDataAdapter and SqlCommand objects? This code is not connected in any
way
> to bound controls until you drag these to the form so I'm confused as to
> what you mean by "disappears".
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> www.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> __________________________________
>
> "dan" <dea@deamon.com> wrote in message
> news:uETuVjPiEHA.3428@TK2MSFTNGP11.phx.gbl...
> > The code generated by the Data controls such as SqlDataAdapter and
> > SqlCommand disappears when a change is made to the form (e.g. changing
the
> > text of a control, adding a new button, etc). Thus the data controls
must
> > be reconfigured which is highly annoying.
> >
> > Does this work as designed, is it a VS fault or am I doing something
> > wrong?
> > Is there a way to avoid this happening?
> >
> > Thanks,
> > Dan
> >
> >
>
>