Retrieve Data From Access VB.Net



In this post- Retrieve Data From Access VB.Net

Important Namespaces Used
--------------------------

Imports System.Data.OleDb
Imports System.Data.DataSet
Imports System.Data

--------------------------

Save Button Click Coding
--------------------------

 Try
            Label3.Text = "Data Retrieved Successfully"
            Dim ds As New DataSet
            Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; 

Data Source=" & Server.MapPath("~/App_Data/StudentData.accdb") & "; Persist 

Security Info=False")
            Dim query As String = "SELECT * FROM PersonalInfo"

            Dim cmd = New OleDbCommand(query, con)
            Dim Da As New OleDbDataAdapter(cmd)
            Da.Fill(ds)
            GridView1.DataSource = ds
            GridView1.DataBind()
            con.Close()

        Catch ex As Exception
            Label3.Text = "There is Some Problem While Saving Data" & 

ex.ToString()

        End Try

0 Comment's

Comment Form