Page: 1 การพัฒนาโปรแกรมประยุกต์บนเว็บ อ. บุรินทร์ รุจจนพันธุ์.. ปรับปรุง 23 มิถุนายน 2550 Data Selecting by ASP มหาวิทยาลัยโยนก จังหวัด ลำปาง ศูนย์กลางความรู้และภูมิปัญญา แผ่นดิน
Page: 2 DSNLess + !recordset (1/5) <% set c = server.createobject("adodb.connection") c = "driver={microsoft access driver (*.mdb)}; " c = c & "dbq=" & server.mappath("dthai97.mdb") sql = "select * from tbthai" set rs = c.execute(sql) do while not rs.eof response.write(rs("fid") & " ") rs.MoveNext loop c.close set rs = nothing set c = nothing %> แฟ้มข้อมูลทดสอบจาก
Page: 3 DSNLess + recordset (2/5) <% set rs = server.createobject("adodb.recordset") c = "driver={microsoft access driver (*.mdb)}; " c = c & "dbq=" & server.mappath("dthai97.mdb") sql = "select * from tbthai" rs.open sql, c, 1, 3 response.write(rs.recordcount & " ") do while not rs.eof response.write(rs("fid")&" ") rs.MoveNext loop rs.close %>
Page: 4 OLEDB Provider (3/5) <% set c = server.createobject("adodb.connection") c.open "provider=microsoft.jet.oledb.4.0; data source=" & server.mappath("dthai97.mdb") sql = "select * from tbthai" set rs = c.execute(sql) do while not rs.eof response.write(rs("fid") & " ") rs.MoveNext loop c.close set rs = nothing set c = nothing %>
Page: 5 DSN (Data Source Name) + !Recordset (4/5) <% set c = server.createobject("adodb.connection") c.open "xdthai97","","" sql = "select * from tbthai" set rs = c.execute(sql) do while not rs.eof response.write(rs("fid") & " ") rs.MoveNext loop c.close set rs = nothing set c = nothing %>
Page: 6 DSN (Data Source Name) + Recordset (5/5) <% set c = server.createobject("adodb.connection") c.open "xdthai97","","" set rs = server.createobject("adodb.recordset") sql = "select * from tbthai" rs.open sql, conn, 1, 3 response.write(rs.recordcount & " ") do while not rs.eof response.write(rs("fid") & " ") rs.MoveNext loop c.close set rs = nothing set c = nothing %>