Can you use the Access 2000-2 with VB 2010 (.net) or do you need 2007 or later
-
Sunday, July 15, 2012 6:38 PM
1.) The Accesss 2000-2 database used with VB6, can they be used with VS2010 or do they need to be converted Access 2007 or later.
2.) Do I need to run Data Source Configuration Wizard to connect the database.
All Replies
-
Sunday, July 15, 2012 6:50 PM
1.) You can access both. You only need the right provider. See http://connectionstrings.com/
2.) No
Armin
-
Sunday, July 15, 2012 8:30 PM
The reason I ask the questions is that with this code:
db As DAO.Database
Dim WS As DAO.Workspace
Dim RS As DAO.Recordset
Dim
SQLQ As
String
''''''''''''''''''''''''''
' Error handling section
On Error GoTo dbGetPartError
''''''''''''''''''''''''''''
' Initialize return value
dbGetPart = 0
' Open the database
WS = DAODBEngine_definst.CreateWorkspace(
"", "admin", "")db = WS.OpenDatabase(dbName,
False)On the line with WS=, An error window says database error occured, Error 5, The type Initializer for 'Georgia.UpgradeSupport' threw an exception. In the immediate window it says, A first chance exception of type, 'System Type Initialization Exception' occured in Georgia.exe -
Sunday, July 15, 2012 8:45 PM
I didn't expect DAO interop. ADO.Net is the data access component to be used in VB.Net:
http://msdn.microsoft.com/en-us/library/e80y5yhx.aspx
I'm afraid, I don't know how to handle DAO in VB.Net. (other than replace it ASAP)
Armin
-
Monday, July 16, 2012 3:05 AM
The initial program that was written in VB5 used the DAO element. I am a confessed dummy when it comes to databases. How would the above code for the DAO be written for ADO.net. -
Monday, July 16, 2012 3:54 AM
How would the above code for the DAO be written for ADO.net.
That's a broad topic. :) I suggest starting here: ADO.Net
Well, what your code actively does is opening a connection, so it's just
Dim con As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbName) con.Open()
That's the provider for the older data base format. For the new one, look at the link given at the beginning (you'll also find it in 1001 examples).
Armin
- Edited by Armin Zingler Monday, July 16, 2012 3:54 AM
-
Monday, July 16, 2012 11:11 AM
Does .net support the DAO database. -
Monday, July 16, 2012 2:18 PM
DAO is not a database. The old DAO is an object model based on the Jet engine, which was the database engine to access Access databases in the format up to version < 2007 (AFAIK). In VB6, DAO was deprecated several years ago and kind of replaced by ADO, later in VB.Net replaced by ADO.Net.
Now there's a new DAO, but I know too little about it to talk. The new database engine - you use a different connection string referring to a different provider - is required to read the newer Access database format.
So, to answer your question indiretly, ADO.Net supports different OleDb providers. There are providers capable of reading any Access database format.
EDIT:
OleDb is only one data provider within ADO.Net: .NET Framework Data Providers (ADO.NET). The chapter also mentions a few OleDb providers. Here are more: Appendix A: Providers. Note that the new provider for Access database is not listed.
Armin
- Edited by Armin Zingler Monday, July 16, 2012 2:29 PM
-
Monday, July 16, 2012 6:35 PM
Decided to go with ado.net and have been doing the changes to replace DAO references in the program.
1.) Removed DAO 3.6 reference and replaced with ADO Ext. 6.02.) Replaced DAO.Database with Data.DataTable
3.) Replaced DAO.TableDef with DataTableReader
4.) Replaced DAO.Recordset with ADODB.Recordset
But I am having problems finding equivalent statements for the following going from DAO to ADO.net
DAO.Database.OpenRecordSet === Data.DataTable.?
DAO.Database.TableDefs === Data.DataTable.?
DAO.Database.Close === Data.DataTable.?
DAO.TableDef.Fields === DataTableReader.?
DAO.Database.Execute === Data.DataTable.?DAO.Workspace === ?
DAO.RecordTypeEnum.dbtext === ?In the upgradeRepot.htm has a statement:
Friend DAODBEngine_definst As New DAO.DBEngine
What is an equivqlent statement in ADO.net
-
Monday, July 16, 2012 7:05 PM
Do not use ADO Ext. 6.0 and the ADODB.Recordset because it is ADO, not ADO.Net.
I suggest reading the ADO.Net documentation linked in a previous message.
Armin
- Proposed As Answer by Mark Liu-lxfModerator Tuesday, July 17, 2012 3:51 AM
-
Tuesday, July 17, 2012 12:04 PM
1.) Does Windows 7 already include MDAC. How do I check the version.
-
Tuesday, July 17, 2012 12:16 PM
I had referenced Microsoft ADO Data Control 6.0(sp6)(OLEDB) is that the same as ADO ext. 6.0
So you are saying I need to remove this reference from the project.
-
Tuesday, July 17, 2012 12:22 PMWhy MDAC? You have the .Net Framework.
Armin
-
Tuesday, July 17, 2012 12:26 PM
I don't know the ADO Data Control. It it is about data binding, it is done differently in .Net: Windows Forms Data Binding, but I know nothing about data binding.
You can remove a reference if you are sure you don't need it anymore. At best, do not remove it but open the project properties -> references tab -> Click on button "remove unused references".
Armin
- Edited by Armin Zingler Tuesday, July 17, 2012 12:26 PM
-
Tuesday, July 17, 2012 2:17 PM
You ask why mdac. One of the references you gave me (.net framework data providers(ado.net)) talks aboutusing MDAC 2.6 or later and the MDAC 2.8 service pack. I am totally clueless when it comes to databases.
The reference also talked about how to include OLE DB by typing 'Imports System.Data.oleDb'. What does that
me. Am I all wet trying to do this.
-
Tuesday, July 17, 2012 3:18 PM
If it's a deployment question I can't tell in details what is required on the target machine. For development, you don't need to install anything additionally. Maybe if you want to access Access 2007+ databases the Ace OleDb provider. But don't install it if everything works well without.
Regarding the 2nd question: (maybe you already know some parts)
The whole project consists of the classes in your own project and the ones in the references assemblies (dll files). As these are pretty many, there's a namespace tree containing all classes (and other types like structures, enums and interfaces). You can compare the namespace tree to the directroy structure on your hard drive. Every class declaration is contained in one of the namespaces. System.Data.oleDb is the full qualified name of one of the namespaces, i.e. there's a root namespace System and a subordinated namespace Data. The classes you need for OleDb specific programming are in the OleDb sub namespace.
If you want to refer to a class in that namspace, you would have to write (e.g.)
Dim con as System.Data.oleDb.OleDbConnection
Dim cmd as System.Data.oleDb.OleDbCommandAs you can see, the namespace name is repeated many times if you continue like that. That's bugging in the long run. Therefore, you can import a namespace by typing "Imports System.Data.OleDb" at the top of a source file. As a consequence, you only have to write
Dim con as OleDbConnection
Dim cmd as OleDbCommandbecause the compiler's search path for identifier names (class names in this case) is extended by the imported namespaces. You could also import namespace at project level (project properties -> references -> box at the bottom).
Armin
-
Wednesday, July 18, 2012 12:09 PM
alright, I started from the beginning. Made myself a small program to get the basics. But I am even having problems with that. Here is the program:
Option Strict Off
Option Explicit On
Imports
System.Data.OleDbImports
System.Data.SqlClientModule
Module1Sub main()
Dim connectstring As String = Provider=Microsoft.Jet.OLEDB.4.0;DataSource=C:\Experiment_AnyCPU - Copy\Database\lasergage.mdb"
Dim connect As New OleDbConnection(connectstring)
connect.Open()
connect.Close()
End Sub
At the line "connect.Open()" it comes up with the error message, "OLeDbExceptionUnhandled, Could not find installable ISAM" I am using windows 7 operating system, and am using Access 2000 data file.
I am using VB 2010. -
Wednesday, July 18, 2012 12:26 PM
I answered my own question. Had to compile using "anyCPU" instead of (x86) but now have different error on the same "connect.Open()". Now it says "InvalidOperationException was unhandled, The 'Microsoft.Jet.OLEDB.4.0' provider not registered on local machine.
If it not registered, how can "Server Explorer" use it to connect to the same file?- Marked As Answer by ojay_orange Thursday, July 19, 2012 2:52 AM
-
Wednesday, July 18, 2012 2:33 PM
First, I don't read code with Option Strict Off. Errors can be everywhere then.
Please use the "insert code" icon
at the top of this message editor to paste code. Otherwise it's hard to read and copy&paste.
Is your initial question solved? I think so. We are now about to start fixing specific errors, so I think opening a new thread would be ok.
To answer this question still here:
You have to switch to x86 because there is no 64 bit jet 4.0 provider. 64 bit will always fail whereas the error you first mentioned can be solved with x86 target. There seems to be a quotation mark missing at the start of the connection string, but I assume it's there in your code.
You do not need to import System.Data.SqlClient because you're not using SQL Server.
The soluton is to insert a space in the connection string: "data source...", not "datasource".
So, if you consider the initial question (and this one) solved, mark a reply as the answer. If you have further questions, please open a new thread. Thanks.
Armin
- Marked As Answer by ojay_orange Thursday, July 19, 2012 2:52 AM

