Micro Niche Builder
Closed Thread
Results 1 to 9 of 9

Thread: How to connect asp.net with MS access

  1. #1

    Default How to connect asp.net with MS access

    Hello

    I want to connect asp.net with ms access but I am not able to do it. Can anyone tell me how can i do it?


  2. SEO Software

  3. #2

    Default

    if you wants to connect asp.net with access to write 0above coding:
    imports system.data.oledb

    dim cn as new oldbconnection("connectionstring")
    dim cmd as new oledbcommand("select * from table name")
    cmd.executereader

  4. #3

    Default

    To connect asp.net with access, do following steps :

    1. Import the follwing namespaces at the top of the page.
    => imports system.data
    => imports system.data.oledb

    2.The write the following code at the page load event
    page_load()
    Dim cn as new oledbconnection("connectionstring")
    dim adp as new oledbdataadapter("select * from table",cn)
    dim ds as new dataset
    adp.fill(ds)

    3. and show it in the required control

  5. #4

    Default

    1. Replace username with your Brinkster hosting account username.
    2. Replace C:\sites\single??\username\database\YourDB.mdb with the path to your web space.
    3. Replace password with the password for the email account used above.
    4. Please log into your account, select the web site settings, and use the absolute path to your file structure.
    <%



    Dim sPath as String = "C:\sites\single??\username\database\YourDB.md b"

    Dim strConnection As String = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" & sPath & ""

    Dim sSQL As String = "Select * from tablename"

    Dim objConnection As Data.OleDb.OleDbConnection = New Data.OleDb.OleDbConnection(strConnection)

    Dim objCommandAuction1 As Data.OleDb.OleDbCommand = New Data.OleDb.OleDbCommand(sSQL, objConnection)

    Dim oDr As Data.IDataReader



    Try

    objConnection.Open()

    oDr = objCommandAuction1.ExecuteReader()

    Do While oDr.Read

    'Write information from database here

    Loop

    oDr.Close()

    Catch ex As Exception

    Response.Write(ex.Message)

    End Try



    objConnection.Close()



    %>

  6. #5

    Red face

    Quote Originally Posted by Amar View Post
    To connect asp.net with access, do following steps :

    1. Import the follwing namespaces at the top of the page.
    => imports system.data
    => imports system.data.oledb

    2.The write the following code at the page load event
    page_load()
    Dim cn as new oledbconnection("connectionstring")
    dim adp as new oledbdataadapter("select * from table",cn)
    dim ds as new dataset
    adp.fill(ds)

    3. and show it in the required control
    thanks for giving such a nice answer..
    its a very helpful posting you have did it...
    and i have tried it to search on Link1
    but not get any satisfactory...
    thanks......
    .......<THANKS>.......

  7. #6

    Default

    It is easy.
    First make connection object then pass connection string for MS access to connection object.....

  8. #7

    Default

    Quote Originally Posted by hiren_mehta007 View Post
    It is easy.
    First make connection object then pass connection string for MS access to connection object.....
    For SQL I m using sql library but for Ms Access which library I have to use??

  9. #8

    Default

    using system.data.oledb
    than take bind source and put one design forum
    in their select property source select and select MS access than select data base then next
    and copy the connection string ok
    use it in coding page

  10. #9

    Default

    This process is same as sql server, only difference is use oledb. As explained above will work for sure.

Closed Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts