Try this code, and tell me what you see:
<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<HTML>
<HEAD>
<TITLE>ADO.NET</TITLE>
</HEAD>
<BODY>
<%
Dim objConexion As SqlConnection
Dim objComando As SqlCommand
Dim objDataReader As SqlDataReader
Dim intContador As Integer
objConexion = New SqlConnection("server=PC;uid=sa;pwd=;database=northwind")
objConexion.Open()
objComando = New SqlCommand("Select * From categories", objConexion)
objDataReader = objComando.ExecuteReader()
%>
<%
intContador = 1
Response.Write("<TABLE
BORDER=1><TR><TD>NRO</TD><TD>ID</TD><TD>NOMBRE</TD></TR>")
While objDataReader.Read
Response.Write("<TR><TD>" & intContador & ".</TD><TD>" &
objDataReader.Item("categoryID") & "</TD><TD>" &
objDataReader.Item("categoryname") & "</TD></TR>")
intContador = intContador + 1
End While
Response.Write("</TABLE>")
objDataReader.Close()
objConexion.Close()
%>
</BODY>
</HTML>
------------------------------------------------------------------
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<html>
<script language="VB" runat="server">
Sub Page_Load(Src As Object, e As EventArgs)
Dim myConnection As SqlConnection
Dim myCommand As SqlDataAdapter
' Create a connection to the "pubs" SQL database located on the
' local computer.
myConnection = New SqlConnection("server=localhost;" _
& "database=pubs;Trusted_Connection=Yes")
' Connect to the SQL database using a SQL SELECT query to get all
' the data from the "Authors" table.
myCommand = new SqlDataAdapter("SELECT * FROM Authors", _
myConnection)
' Create and fill a DataSet.
Dim ds As DataSet = new DataSet()
myCommand.Fill(ds)
' Bind MyDataGrid to the DataSet. MyDataGrid is the
' ID for the DataGrid control in the HTML section.
MyDataGrid.DataSource = ds
MyDataGrid.DataBind()
End Sub
</script>
<body>
<h3><font face="Verdana">
Simple Select to a DataGrid Control.
</font></h3>
<ASP
ataGrid id="MyDataGrid" runat="server"
Width="700"
BackColor="#ccccff"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
EnableViewState="false"
/>
</body>
</html>