how do you send data to an access file

Discussion in 'MySQL' started by countolaf, Nov 23, 2008.

  1. #1
    hi everyone,

    I just want to ask how do you exactly send a data to an access file... I mean say for example I have a website that has an online application form. Then for every text inputed into the textbox it would be sent to a .mdb microsoft access file... How do you exactly do it? I am using Microsoft Web Developer 2005 right now...
     
    countolaf, Nov 23, 2008 IP
  2. drew22299

    drew22299 Guest

    Messages:
    76
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    First you need to create and upload your msaccess database file using ftp. You can create column names using mysql queries but it might be quicker to make the table using msaccess. Then you need a script written in a langauge such as PHP or ASP.net which will take the data entered into the form and insert it into the ms access file.

    For example,

    ASP.net version (not sure about how to do it using ASP.net but here are some links you might find useful)
    http://www.aspfree.com/c/a/Microsoft-Access/Connecting-to-a-Microsoft-Access-database-with-ASPNET/
    http://www.tek-tips.com/viewthread.cfm?qid=949066&page=6
    http://www.w3schools.com/aspnet/aspnet_dbconnection.asp

    form1.htm

    <form name='form1' method='post' action='store_data.php'>
    <input type='text' name='data' />
    <br>
    <input type='submit' />
    </form>
    PHP:

    To make an ODBC connection in ms access

    1.Open the Administrative Tools icon in your Control Panel.
    2.Double-click on the Data Sources (ODBC) icon inside.
    3.hoose the System DSN tab.
    4.Click on Add in the System DSN tab.
    5.Select the Microsoft Access Driver. Click Finish.
    6.In the next screen, click Select to locate the database.
    7.Give the database a Data Source Name (DSN).
    8.Click OK.

    http://www.w3schools.com/PHP/php_db_odbc.asp

    Next make the php (or ASP.net) page to get the data entered by the user and insert into the database

    store_data.php

    //Get the data the user entered
    $dataToStoreinDB = $_POST['data'];
    
    //Use ODBC connection to connect to your database
    $conn=odbc_connect('yourdatabasename',' ',' '); //username, password in the other parameters
    
    //Select
    $sql="INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...)";
    
    $rs=odbc_exec($conn,$sql);
    PHP:
     
    drew22299, Nov 24, 2008 IP
  3. countolaf

    countolaf Active Member

    Messages:
    662
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #3
    thankyou so much dude... it helped me a lot...
     
    countolaf, Nov 24, 2008 IP
  4. drew22299

    drew22299 Guest

    Messages:
    76
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I'm glad you found my post useful! I wasn't sure if it was the information you were looking for because you are using ASP.net.
     
    drew22299, Nov 25, 2008 IP