Procédure de connexion à une base de donnée MS-SQL 2008 en asp
Editer/créer le fichier asp de connexion à MS-SQL
Exemple :
<%
Dim sConnStr, oConn
sConnStr = "Provider=sqloledb;Data Source=mssqlxxx.swisscenter.com,1433;Initial Catalog=db_name;User ID=db_user;Password=db_password;"
Set oConn = Server.CreateOBject("ADODB.Connection")
oConn.Open sConnStr
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "SELECT * FROM my_table", oConn
Response.Write("<table>")
do until rs.EOF
Response.Write("<tr>")
for each x in rs.Fields
Response.Write("<td>" & x.value & "</td>")
next
Response.Write("</tr>")
rs.MoveNext
loop
Response.Write("</table>")
rs.Close
oConn.Close
%>
Article ID: 78, Created: 9/18/2012 at 1:46 PM, Modified: 9/18/2012 at 1:46 PM