คำถามที่พบบ่อย |
>> จะใช้ ASP
ติดต่อกับฐานข้อมูล Ms Access
โดยไม่ใช้ ODBC ได้อย่างไร? |
|
ต่อไปนี้เป็นสคริปต์ตัวอย่างที่ใช้ในการติดต่อกับฐานข้อมูล
Ms Access โดยไม่ต้องใช้ ODBC Driver |
|
หมายเหตุสำคัญ |
- ตัวอักษรสีแดง
คือพาธหลักของฐานข้อมูลที่ท่านต้องเปลี่ยนแปลงให้ตรงกับข้อมูลของท่าน |
- ไม่ต้องใช้ ODBC Driver |
|
ตัวอย่าง |
|
<%
connect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=d:/webhosts/yourdomain_com/www/database/DatabaseName.mdb"
Set con = Server.CreateObject("adodb.Connection")
con.Open connect
Set rs = Server.CreateObject("adodb.Recordset")
command = "select name from demodatabase"
rs.open command,con,0,1
Do While not rs.eof
Name = rs("name")
Response.write(Name &
"<br>")
rs.MoveNext
Loop
rs.close
con.close
set rs = nothing
set con = nothing
%> |
|
|
|