[size=2][color=#0000ff]Dim[/color][/size][size=2] myConn [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String[/color][/size][size=2] = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\myDatabase.mdb; Persist Security Info=False;"
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] oledbcon [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] OleDbConnection(myConn)
[/size][size=2][color=#0000ff][/color][/size]
[size=2][color=#0000ff]Try
[/color][/size][size=2][/size][size=2][color=#0000ff]If[/color][/size][size=2] oledbcon.State = ConnectionState.Closed [/size][size=2][color=#0000ff]Then
[/color][/size][size=2]oledbcon.Open()
[/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]If
[/color][/size][size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] strSQL [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String[/color][/size][size=2] = "SELECT * FROM Table1"
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] cmd [/size][size=2][color=#0000ff]As[/color][/size][size=2] OleDbCommand = [/size][size=2][color=#0000ff]New[/color][/size][size=2] OleDbCommand(strSQL, oledbcon)
[color=blue]Dim[/color] objreader as [size=2][color=#0000ff]As[/color][/size][size=2] OleDbDataReader = cmd.ExecuteReader[/size]
[size=2][/size]
[size=2][color=blue]While[/color] objRead.Read[/size]
[size=2][/size]
'do something with the data i.e. fill combo, listview or something else
[size=2][/size]
[size=2][color=blue]End While[/color][/size]
[size=2]objread.Close()
[/size]
[/size][size=2][color=#0000ff]Catch[/color][/size][size=2] ex [/size][size=2][color=#0000ff]As[/color][/size][size=2] Exception
MessageBox.Show(ex.Message)
[/size][size=2][color=#0000ff]Finally[/color][/size]
[size=2][color=#0000ff][/color][/size]
[size=2][color=#0000ff]If[size=2][color=#000000] oledbcon.State = ConnectionState.Open [/color][/size][size=2][color=#0000ff]Then[/color][/size][/color][/size]
[size=2][color=#0000ff]
[/color][/size][size=2]oledbcon.Close()
[color=blue]End if[/color]
[/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Try[/color][/size]