I am having some trouble connecting to my Access Database from Visual Studio Express 2005.
I can add a connection if it is a sql database, but when i change the
Datasource to the access option and hit ok i get a window that allows
me to change my Connection string, and thats it. If i cancel it exits
the wizard. Also the only data provider i have is .net framework
provider for ole db.
Should i have a second provider
The other software i have installed is access 97,and access 2003 both
with their corresponding developer software. I also have an educational
version of visual studio .net 2003 and i can connect to the db using
.net 2003.
Thanks in advance for any help you can provide.

Connecting to access mdb file problem.
JStorm
I don't know how to say it loud enough that one does NOT need Access installed on a system to use an Access database.
I've done MANY projects..... I'm doing a large one right now where I have used an Access database in the absense of the Access product and it's quite within any licensing agreements.
The engine for Jet is MDAC v2.8 and installed with SP2 and is a prerequiste for any vs2005 product.
Walter Sagesser
"when i change the Datasource to the access option and hit ok i get a window that allows me to change my Connection string, and thats it."
this is the sticking point - we're not getting a window with DataSource:Microsoft Access Database File (OLE DB) because we're stuck at the empty ConnectionString field!
Is something wrong with our project/vb express set-up in the first place perhaps
every account i read of adding a access database makes it sound so simple with just a few clicks to implement, and no mention of ConnectionStrings!
ye gadz!
BryanMiller
Hi Evan,
if you choose data source as Microsoft Access, then you will get DataProvider for Oledb, and if you choose SQL, you will get DataProvider for SQL Server.
but you said that when you click ok:
but when i change the Datasource to the access option and hit ok i get a window that allows me to change my Connection string, and thats it.
here after you click ok, you should get a window with DataSource:Microsoft Access Database File (OLE DB).
Anyway, my answer to your question: Should i have a second provider is No.
for Access, you will get oledb provider
good luck
mario
trumpy81
When you open the DATA SOURCE Configuration Wizard, you should see a popup form that includes " Choose Your Data Connection", then, it says, "Which Data Connection should your application use to connect to the database " You will have a dropdown list box just below that. Ignore the Text near the middle that has a Plus "+" sign and the text "Connection String". Instead, next to the DROPDOWN box below where it says" Which Data Connection should your application use to connect to the database" there is a BUTTON that says" NEW CONNECTION" Click it!!
You will then get another popup box that says"Add Connection" at the top of the box. You will see a textbox about half way down that says"DATA SOURCE" and to the RIGHT of it a BUTTON that says"CHANGE". Click that Button, you will get another popup box that says" Change Data Source" there will be a list of all the available Data sources on your system. If Access is properly installed, it should be amoung the list and you should be able to click on it and then Click OK. Then, you will be taken back to the "Add Connection " box, and you can then go to the section that says"Database File Name". Either type in the name of the database or Click the Button that says"BROWSE" and browse to the folder that contains your database. If the database requires a UserName and Password, you can enter those here too. Then, you can also TEST the connection. Once that is done, Click OK. And your database will be added to your project. If none of this works, then there are other issues with your system. And since you re-Installed everything, the only other possible problem, is either an AntiVirus program or Firewall acting up and blocking the connection. One other thing, does the database open in Access itself on this computer If Access cannot open it, then neither will you be able to open it from Visual Basic 2005EE.
james
aka:Trucker
EDIT to make ReneeC happy: You DO NOT NEED ACCESS itself installed to run/write a program to connect to and interact with, an ACCESS DATABASE. You do need, MDAC v2.8 ( Microsoft Data Access Components v2.8). I mentioned it in the above post, only because if you do happen to have Access itself installed and can open your database from it, and yet, you cannot create a connection from within Visual Basic 2005 Express Edition's Data Connection Wizard, then , I was suggesting that you either had a coding or installation problem. But, first thing to do is to follow the steps I outlined above, and then if that doesn't work, try installing MDAC v2.8 again. Go to this link: http://www.microsoft.com/downloads/details.aspx FamilyID=6C050FE3-C795-4B7D-B037-185D0506396C&displaylang=en
Jiajia
as much as i'd love to be an expert purist, i'm following a path of learning akin to how i learned html: needs drive the knowledge required.
i found using interfaces and wizards are a great way i can get my head round the processes and work flow, and then i delve deeper into what the code is doing, and start getting cocky once i understand what the wizards and wysiwyg interfaces have produced. i thought this was the point of visual basic anyway
but regarding this db issue i just can't find a sensible explanation to get the wizard to work, or find a basic description of what a connection string is, how to modify one, never mind trying to understand the code. eek!
lode
Do you have Access installed on your home machine I run a laptop with Access and SQL both on XP Home with no problems and using VB2005 Express Edition. My thoughts are , if you cannot Change the Data Source thru the Add Connection portion of the Wizard, then it is probable that you don't have Access installed or there is a problem with the installation. Also, re-read AiwenGuo's post above and be sure to follow the steps he gives you for Adding a Connection to an Access Database. Otherwise, all I can think of is that you either have a problem with the Access installation or VB2005 Express on your home system. A re-install may be in order.
james
aka:Trucker
nitinca
hi evan,
i'm currently scouring the forums with my beady eyes for the same answer to your problem, have you managed to work it out at all
i find many things about connection strings but they're all like five steps ahead from what i want to know to understand what the hell is required here. heck, i'm even following the first chapter involving databases from a ...For Dummies book and that doesn't mention connection strings at all. just goes right through with the wizard. aaargh!
let me know if you have any luck, i will like-wise
matty
Enrique0210
I understand that and I too know that all is needed is MDAC v2.8. BUT, I think it is a good idea for someone developing an ACCESS application to have ACCESS itself installed on their development system. It helps when working with pre-existing tables. When creating a new Access Database from code, (including building tables with ADOX) Access itself is not needed. Nice to have, but, not needed. I was not saying to have Access installed for licensing purposes ( again, I know the requirements). Simply, to make working with a pre-existing database easier for the person developing an application. AND as I explained in my previous post, if the table can be accessed from ACCESS itself, then, that points to either a coding or installation problem( with Visual Basic 2005 Express Edition, not ACCESS).
Since, I have been reading and answering in this particular thread, I have yet to see a response from the original poster that he has followed the instructions given on how to ADD a Connection.
james
aka:Trucker
KimKim1
thanks i'll give that a go later today... from the sounds of your post its seems like that is what i'm doing. i get stuck at the Connection String bit (see first post again)
i want to understand what this element its requesting is; it seems like i can't add a .mdb access file until this field is filled and i get an error no matter what i add.
i have found a webpage that i've seen mentioned in various forums called connectionstrings.com, and i have tried editing the path to point at my .mdb file utilising the various oleDb access entries to point at the path of my file but i always get an error!
i can not get back to the window with the option to browse for your .mdb file with the access databse option now selected. it always flips back to sql connection because of the connection string error.
GazCorb
" i'm even following the first chapter involving databases from a ...For Dummies book and that doesn't mention connection strings at all. just goes right through with the wizard. aaargh!"
I have totally stayed away from wizards and have instead written code. I don't know what a wizard is doing or what a wizard has built. But I always know what I've written.
Secondly... I hope Cgraus comes by... but people new to programming need to be working on simple fundamentals... not on databases.
Nick Porter
hi trucker, thanks for your reply.
yes i do have access 2003 installed on my home machine. could there be an element of it which requires installtion i may not have let it install
the version of access at work infact was from office 97... not that i'd have thought it would make too much difference
i'll check my installation disk anyhow for anything that looks suspicious and for any further office updates other than the latest service pack i'm already on.
i'll let y aknow later tonight, thanks again, everyone !
hwage
update!!!
ok i just tried the adding an access databse file through another installation of vb express on an xp pro machine at work (my problem is occuring at home on xp home).
the steps to add a database through the data connection/server wizard worked flawlessly; selected oledb access database type, then immediately i was prompted to browse for my access database with none of this dumb looking screen asking for a ConnectionString.
so, i'm doing the procedure correctly;what could be wrong with my project/vb express set-up, or windows xp home that is causing my sticking point concerning ConnectionString
sposs
i have uninstalled vb express and access 2003 and re-installed both making sure anything .net/programming related was installed in the advanced options of the access installation - still getting this window requesting a connection string with a blank field that creates errors what ever i try and feed it.
by the way the error i get from the connection string window request is "format of the initialisation string does not conform to specification starting at index 0".
i have also tried to add an access database in VWD and i get exactly the same scenario occuring, so i'm assuming its a system thing now. its sooh frustrating when i've seen how smooth and slick it should work... grrr snarl.
if anyone's any ideas at all i'd be greatful but i know this is more of a programming forum... sigh
onesqlguy
Hi,
In VB Express edition, you should be able to connect to either Access database or SQL Express database file. And it should list both OLEdb provider and SQL provider lin the Data Provider combobox in "Change Data Source" Dialog.
When you changed the datasource to be the Access option, did you go through the following steps:
1) Select the connection node in Server Explorer, from context menu choose "Modify Connection..." command, then launch the "Modify Connection" dialog
2) In "Modify Connection" dialog, click the "change..." button next to the Data source textbox. Then launch the "Change Data Source" Dialog
3) In "Change Data Source" dialog, select the Data Source to be "Microsoft Access Database File", then click OK
4) It goes back to the "Modify Connection" dialog, now in the Data Source textbox, it shows "Microsoft Access Database File (OLE DB)",
Then you can input your access database file path and name, by clicking ok, it should be able to change the connection to use the Access file you choose.
Can you please try the above steps and let me know if you still see the issues
Thanks.
Aiwen Guo
Visual Basic Testing