9keng


How connect to database from javascript

เขียนแล้วใน Programming โดย 9keng บน มีนาคม 28, 2007

ลักษณะการ connect จะเป็นแบบ client conncet มากกกว่า ภายในเครื่อง local เอง ในที่นี้จะเป็น Access


< html >
< SCRIPT LANGUAGE=javascript >
< !--
function ConDB()
{
var conn = new ActiveXObject("ADODB.Connection") ;
var connectionstring="Provider=SQLOLEDB;Password=;User ID=;Initial Catalog=;Data Source=;"
conn.Open(connectionstring);
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 OnLoad=”javascript:ConDB()” >< /body >
< /html >

3 Responses to 'How connect to database from javascript'

Subscribe to comments with RSS หรือ TrackBack to 'How connect to database from javascript'.


  1. หุหุพึ่งรู้จะเนี่ยว่า JS ก็ใช้ได้

  2. ตะลึง กล่าว,

    โอ้วววววววววววววววววววววววววววววววววววววว
    พระเจ้าจอร์จจจจจจจจจจจจจจจจจจจจจจจจจจจจจ

  3. AdaHcuS กล่าว,

    มือใหม่หัดเขียน js
    เล่นกับฐานข้อมูลด้วย
    หาอยู่พอดีเลย


ใส่ความเห็น

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out / เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out / เปลี่ยนแปลง )

Connecting to %s


Follow

Get every new post delivered to your Inbox.