1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
<SELECT>
<%
Dim conn, strConn, rs
Set conn = Server.CreateObject("ADODB.Connection")
'Pour l'accès à la base access
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Mabase.mdb"
conn.ConnectionString = strConn
conn.Open
Set rs = conn.Execute("SELECT * FROM MaTable")
rs.MoveFirst
Do While Not rs.EOF
%>
<OPTION VALUE="<%= rs(2) %>"><%= rs(2) %></OPTION>
<%
rs.MoveNext
Loop
%>
</SELECT>
<%
conn.Close
'Pour la base SQLServer
strConn = "Provider=SQLOLEDB;Data Source=(local);Initial Catalog=Northwind;
Integrated Security=SSPI"
conn.ConnectionString = strConn
conn.Open
Set rs = conn.Execute("SELECT * FROM Customers")
'Ensuite traîtement du recordSet pour manipuler les données
'Et enfin
conn.Close
Set conn = Nothing
%> |