Visual Basic 2008 and Access 2007

I

Ivan Weiss

So I am returning to programming after a hiatus to write an app for my
office.

I am writing it in vb.net 2008 using access 2007 as my database. My
question is probably pretty elementary...

I have made three projects within the solution, data access, objects,
and UI.

In the data access project I saved the empty database I want to use.

However, when I test my app the application is looking for it in the
debug folder of the UI.

My UI references a class in the objects project which references the
data access class in the Data project.

-Ivan
 
S

sloan

You need to learn what
connectionStrings are in the config file:

<connectionStrings>
<add name="AccessMainConnectionString"
connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source='C:\Inetpub\wwwroot\DotNet\v20\Source\Applications\MultiRDBMSSupport\DataStores\AccessDatabaseCopy\Nwind.mdb'"
providerName="System.Data.OleDb" />

</connectionStrings>


Check here for an Access( JET DATABASE is a better term) example:

http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!176.entry
 
I

Ivan Weiss

My connection string is right, I corrected the one issue that had it
pointing at the UI project. I didnt realize Visual Studio 2008 had a
variable entry in the connection string so now it explicitly points to
the data access folder.

However, it is still looking for it in the debug folder. Do I just need
to put the db there or is there a way to over-ride that?

-Ivan
 
I

Ivan Weiss

Correction, it is still looking in the UI.

Here is my connection string. I changed the password so as not to list
it here.

<connectionStrings>
<add
name="Data_Access.My.MySettings.Studio_e_Design_Manager_DBConnectionStri
ng"
connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data
Source='C:\Documents and Settings\iweiss\My Documents\Visual Studio
2008\Projects\Studio-e Design Manager\Data
Access\Studio-e_Design_Manager_DB.accdb';Persist Security Info=True;Jet
OLEDB:Database Password=*****"
providerName="System.Data.OleDb" />
</connectionStrings>

-Ivan
 
S

sloan

If you put the full path in the connection string, that is where it should
be trying to get it:

<connectionStrings>
<add name="AccessMainConnectionString"
connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source='C:\MYFULLPATH1\MyFullPath2\Nwind.mdb'"
providerName="System.Data.OleDb" />

</connectionStrings>


If you have the full foldername (as above) in your
connectionStrings......then there shouldn't be any "its trying to use the
debug directory" voodoo happening.


Did you "drag" any datasets or table adapters. There is (some other
microsoft) voodoo that will embed a hardcoded database path sometimes.

Do a search for files and seach for "mdb" or something.
As in "Start / Search / Files&Folders" (<<XP) and "file contains" or " a
word or phrase in the file"

Keep in mind that Xp and Vista don't always search all the files.
http://www.dougknox.com/xp/tips/xp_bad_search.htm
 
S

sloan

As I said, try to find a hidden(voodoo) version of the db somewhere.

Search for accdb in the files.

Sometimes with the "drag and drop" DataSets and TableAdapters, VS200x will
put a hidden connection string inside the project to where you cannot see
it.

This is a remote (small) possibility. I'm guessing, but I've seen it
before.
 
I

Ivan Weiss

I got that to work.

Now for some reason my insert into statement (done as a stored query in
Access 2007) is not working. It claims it is missing a field yet it is
right, grrrr....

I need to investigate this more and if I cant resolve will start a new
thread.

-Ivan
 

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