0

i am cesar and i want to know on how to query records from ms access to the vb.net....any reply will be appreciated! thank you!

2
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by cesdomsoft
0

Are you trying to extract records from Access database into the vb.net application? If so, what do you want to display them in, Datagridview?

For reading only or for editing also?

0

Get your connection string from here:
http://www.connectionstrings.com/

Then:

Dim SampleConn As New OleDbConnection("Whatever Connection String You Need To Use Here")
Dim SampleAdapter As New OleDbDataAdapter("SELECT * FROM SampleTable", SampleConn)
Dim SampleDataSet As New DataSet
Dim SampleBind As New BindingSource

     Try

            SampleAdapter.Fill(SampleDataSet, "SampleTable")
            SampleBind.DataSource = SampleDataSet.Tables(0)
            Me.SampleDataGridView.DataSource = SampleBind
            SampleConn.Close()

        Catch ex As Exception

            MsgBox(ex.Message)

        Finally

            If SampleConn.State = ConnectionState.Open Then

                SampleConn.Close()

            End If

        End Try

This is off the top of my head so let me know how that works out for you. Obviously you need to change pretty much anything prefixed with "Sample" to your own system.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.