DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

SQL Server ASP Database Test

01.01.2007
| 5698 views |
  • submit to reddit
        // basic sql server database asp code test

<%
str_ConnectionString = "Provider=SQLOLEDB;Data Source=servername;Initial Catalog=database;User Id=user;Password=pwd;"
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open str_ConnectionString

set rs = Server.CreateObject("ADODB.recordset")
strSQL="select * from tablename"

rs.Open strSQL, oConn

do until rs.EOF
	for each x in rs.Fields
		response.write x.value & "|"
	next
	rs.MoveNext
	response.write "<br>"
loop	

rs.Close

oConn.Close
set oConn = Nothing
%>