Connection string for MS access 2000 data base in vb.net

Hi,

I am using MS access 2000 as data base with vb.net windows application.Using VS 2005 version.

Thanks in advance
futurebuildersAsked:
Who is Participating?
 
rockiroadsConnect With a Mentor Commented:
For vb.net you have to use OleDbConnection as that supports Jet

this is sample code I have in my test app. It reads the db, runs the sql and returns the result


        Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\temp\test.mdb"
        Dim conn As OleDbConnection
        Dim cmd As OleDbCommand
        Dim reader As OleDbDataReader
        Dim sql As String

        conn = New OleDbConnection(connectionString)

        conn.Open()
        sql = "SELECT COUNT(*) AS MyTotal FROM Table1"
        cmd = New OleDbCommand(sql, conn)
        reader = cmd.ExecuteReader()
        reader.Read()

        MsgBox(reader.Item("MyTotal"))
        conn.Close()


and the two namespaces I included are

Imports System.Data.SqlClient
Imports System.Data.OleDb


0
 
John (Yiannis) ToutountzoglouInstructor Multiengine PilotCommented:
Take a look www.connectionstrings.com ...and check strings with access
hope it helps...
0
 
futurebuildersAuthor Commented:
Thanks for your reply.

But the above code is giving error as "Could not find installation of ISAM"



0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
John (Yiannis) ToutountzoglouInstructor Multiengine PilotCommented:
0
 
rockiroadsCommented:
what version dotnet are you using? not your vs version but the framework. earlier versions of ado.net didnt work very well apparently http://support.microsoft.com/kb/318161

can u post the connection string you used? make sure no errors in there.
0
 
Mohamed AbowardaSoftware EngineerCommented:
0
 
futurebuildersAuthor Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.