DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2004
    Posts
    717

    Saving Record - AJAX

    Is it possible to connect with database (eg: mysql) by using AJAX?
    It would be great if anyone show me the example for saving record to mysql database by using AJAX?
    I found some articles but we hav to use one Server-side Script....
    Any Idea.
    Best Regards,
    Michael Sync
    http://michaelsync.net

    The more you share,The more you get

  2. #2
    Join Date
    Dec 2004
    Posts
    717
    I got some coding from internet.. but conn variable is always emty("")..
    Do you have any idea??

    My Env:
    - WinXp
    - VS 6.0, .NET 2003, .NET 2005 and MySQL, MSDE and FireBird.

    Any Idea?? Thanks.

    Code:
    <SCRIPT LANGUAGE=javascript>
    <!--
    function ConDB()
    {
    var conn = new ActiveXObject("ADODB.Connection") ;
    //var conn = CreateObject("ADODB.Connection");
    alert(conn);
    
    //var connectionstring="Provider=SQLOLEDB;Password=;User ID=;Initial Catalog=;Data Source=;"
    //var connectionstring="Provider=SQLOLEDB;Password=;User ID=gpctadmin;Initial Catalog=;Data Source=;"
    var connecitonstring = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=127.0.0.1;DATABASE=test;UID=root;PWD=testing123;" //_  & "OPTION=" & 1 
    alert(connecitonstring);
    if(conn != ''){
    conn.Open(connectionstring);
    alert(conn);
    }
    else{
     alert("d");
    }
    //var rs = new ActiveXObject("ADODB.Recordset");
    //rs.Open("SELECT * FROM YourTablename ", conn);
    
    //rs.MoveFirst
    //while(!rs.eof)
    //{
    //document.write( yourtablefieldname);
    //rs.movenext;
    //}
    
    //rs.close;
    //conn.close;
    } //-->
    </SCRIPT>
    <body topmargin="0" OnLoad="javascript:ConDB()">
    Best Regards,
    Michael Sync
    http://michaelsync.net

    The more you share,The more you get

  3. #3
    Join Date
    Dec 2004
    Posts
    717
    I think this coding can't make connection with server...
    Best Regards,
    Michael Sync
    http://michaelsync.net

    The more you share,The more you get

  4. #4
    Join Date
    Oct 2004
    Location
    Baltimore MD
    Posts
    69
    The best way to interact with a MySQL db is to write a little PHP script to except a SQL statement and return the results...

Similar Threads

  1. Replies: 7
    Last Post: 07-09-2006, 01:56 AM
  2. New forum + some AJAX links
    By Lori in forum AJAX
    Replies: 0
    Last Post: 02-09-2006, 01:26 PM
  3. Invalid DNS record
    By fegf in forum .NET
    Replies: 0
    Last Post: 12-30-2005, 04:51 AM
  4. Saving picture to record
    By miss_jess in forum VB Classic
    Replies: 1
    Last Post: 05-11-2005, 05:16 AM
  5. NullPointerException when reading text file
    By Andrew McLellan in forum Java
    Replies: 3
    Last Post: 05-09-2001, 05:34 PM

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
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links