-
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.
-
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()">
-
I think this coding can't make connection with server...
-
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
-
By bubberz in forum ASP.NET
Replies: 7
Last Post: 07-09-2006, 01:56 AM
-
Replies: 0
Last Post: 02-09-2006, 02:26 PM
-
Replies: 0
Last Post: 12-30-2005, 05:51 AM
-
By miss_jess in forum VB Classic
Replies: 1
Last Post: 05-11-2005, 05:16 AM
-
By Andrew McLellan in forum Java
Replies: 3
Last Post: 05-09-2001, 05:34 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|