Hi Miha,
thank you for your quick reply.
What you mentioned is exactly the point. When I'm in my debug session
I'm looking at this very property of my DataAdapter. The
ConnectionString property inside the
DataAdapter.SelectCommand.Connection contains the correct path and
should be ok, as it is constructed via template where only the path to
the database is inserted (and it worked with the old location of the
database).
The DataSource property of DataAdapter.SelectCommand.Connection also
points to the correct database so I'm quite at a loss
Andi
Miha Markic [MVP C#] schrieb:
> Hi,
>
> DataAdapter.Fill uses DataAdapter.SelectCommand.Connection instance.
> Make sure it is the one you want (are you sure that the connection
string is
> ok?).
>
> --
> Miha Markic [MVP C#] - RightHand .NET consulting & development
> www.rthand.com
> SLODUG - Slovene Developer Users Group www.codezone-si.info
>
> "Andi" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hello,
> >
> > I'm hoping that someone out there can help me out of this.
> > I'm having several DataAdapters which are referencing all to the
same
> > OleDbConnection object. At construction time of my DAL component,
the
> > connection is instantiated (but not opened yet) and given a
connection
> > string.
> > Once I want to access the database, I construct an instance of the
> > according DataAdapter, assign the OleDbConnection to its SELECT,
> > INSERT, UPDATE and DELETE commands and finally open the connection.
> > When I want to execute the query, e.g. when I call the Fill()
method of
> > the adapter, I get an exception telling me that the database could
not
> > be found.
> > The weird thing about this is the fact, that the database path
returned
> > by the exception is _not_ the one I specified in my connection
string
> > in the first place.
> > In fact, the path stated by the exception points to an old location
I
> > used several days ago.
> > So I debugged my application and stopped at the line containing the
> > Fill() command:
> >
> > try
> > {
> > ...
> > -> myAdapter.Fill( dataset, tablename);
> > }
> > catch(Exception ex)
> > {
> > ...
> > }
> >
> > When examining the connections assigned to the SELECT, INSERT,
UPDATE
> > and DELETE commands of 'myAdapter', all of them pointed to the
correct
> > database.
> > I really don't know where the Fill() command gets the old path
from. Am
> > I overlooking something?
> >
> > Andi
> >