Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Microsoft Jet OLEDB 4.0 with access 97

Posted on 2006-11-22
5
Medium Priority
?
786 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 10

Assisted Solution

by:gangwisch
gangwisch earned 375 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 375 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 375 total points
ID: 18004276
Easy solution? Use SQL Express instead of Access :):)
0
 
LVL 34

Accepted Solution

by:
Sancler earned 375 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

715 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