Solved

Microsoft Jet OLEDB 4.0 with access 97

Posted on 2006-11-22
5
771 Views
Last Modified: 2008-02-26
I'm using Visual Basic 2005 from Visual Studio 2005
This line of code works well in some machines but in one with Windows 2000 and Access 97 it fails with a :  System.NullReferenceException

I think that maybe is because Microsoft Jet OLEDB 4.0 needs Access 2000 or higer, in that case how can I write the code? Even if the user haven't Access, how it work?

Thanks


        Dim strConnectionString As String = _
            "Provider=Microsoft.Jet.OLEDB.4.0;" & _
            "Data Source=" & _
            strPathCarpetaEntorno & "entorno.mdb;"
        Dim objConnection As New OleDbConnection(strConnectionString)
        Dim strSQL As String =   "Select codigoasesor,asesor from asesor"
        Dim objCommand As New OleDbCommand(strSQL, objConnection)
        Dim objReader As OleDbDataReader
        Try
            objConnection.Open()
            objReader = objCommand.ExecuteReader()
            While objReader.Read
                Me.cboAsesor.Items.Add(objReader.Item("codigoasesor") & " " & objReader.Item("asesor"))
            End While
        Catch OleDbExceptionErr As OleDbException
            Debug.WriteLine(OleDbExceptionErr.Message)
        Catch InvalidOperationExceptionErr As InvalidOperationException
            Debug.WriteLine(InvalidOperationExceptionErr.Message)
        End Try

0
Comment
Question by:cpx_Support
5 Comments
 
LVL 10

Assisted Solution

by:gangwisch
gangwisch earned 125 total points
ID: 17997267
Standard security:

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;User Id=admin;Password=;"



 Workgroup (system database):

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet OLEDB:System Database=system.mdw;"



 With password:

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet OLEDB:Database Password=MyDbPassword;"

there are the ways to set it up. But with access 97 you may find using a data source name a little easier:

DSN:

"DSN=myDsn;Uid=myUsername;Pwd=;"

 File DSN:

"FILEDSN=c:\myData.dsn;Uid=myUsername;Pwd=;"

Good Luck
0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 125 total points
ID: 17997272
What line are you getting the exception on?

Bob
0
 

Author Comment

by:cpx_Support
ID: 18001374
Two coments.
Does I have to ad to prerequisites: the "Microsoft Data Access Components"?

I don't know the line of the exception because it happen in the client machine not in my machine in debug mode. Then how can I write the code to get the line of the exception?

Thanks
0
 
LVL 24

Assisted Solution

by:Jeff Certain
Jeff Certain earned 125 total points
ID: 18004276
Easy solution? Use SQL Express instead of Access :):)
0
 
LVL 34

Accepted Solution

by:
Sancler earned 125 total points
ID: 18005282
I think Access97 in fact works with Jet 3.5 rather than 4.0.  The versions are supposed to be backward-compatible, but I have read about (although never personally experienced) some problems with that.  So one thing you might try is replacing (for the offending machine) this line

           "Provider=Microsoft.Jet.OLEDB.4.0;" & _

with

           "Provider=Microsoft.Jet.OLEDB.3.5;" & _

Roger
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
.net VBA word safemode 1 38
System32Int Error 8 56
Events in static methods 3 50
Web Form VB.Net  import CSV 4 24
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now