제목 : 10.SELECT명령실행하기(데이터질의).aspx
<%@ Import NameSpace="System.Data" %>
<%@ Import NameSpace="System.Data.SqlClient" %>
<%
Dim objConnection As SqlConnection
Dim objCommand As SqlCommand
Dim objDataReader As SqlDataReader
Dim strQuery As String
objConnection = New SqlConnection("server=localhost;uid=sa;pwd=;database=ADOdotNET")
objConnection.Open()
strQuery = "Select * From ADOdotNET"
objCommand = New SqlCommand(strQuery, objConnection)
objDataReader = objCommand.ExecuteReader()
While objDataReader.Read()
Response.Write(objDataReader.Item("name") & "<br>")
End While
objDataReader.Close()
objConnection.Close()
%>