Wednesday, 26 August 2015

JAVA : DATA BASE CONNECTION WITH MSACCESS 2013



 The given below are  header files have to inlcude for the connection of access database
---------------------------------------
Imports System
Imports System.Data
Imports System.Data.OleDb

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




next copy the complete page load code for database connection as well as retreival of information .
using data reader.
--------------------------------------------------------
    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        ' The connection string assumes that the Access 
        ' Northwind.mdb is located in the c:\Data folder.
        Dim connectionString As String = _
             "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\netprgm\Database1.accdb"

        ' Provide the query string with a parameter placeholder.
        Dim queryString As String = "SELECT * from  Table1 ;"
          

     


        Dim connection As New OleDbConnection(connectionString)

        ' Create the Command and Parameter objects.
        Dim command As New OleDbCommand(queryString, connection)
      
        Try
            connection.Open()
            Dim dataReader As OleDbDataReader = _
             command.ExecuteReader()
            Do While dataReader.Read()
                lbl1.Text = lbl1.Text + " " + dataReader(1)
            Loop
            dataReader.Close()

        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try


    End Sub
---------------------------------------