I recently installed XP Professional (with IIS 5.1) and VB.net standard.
I'm following the instructions in Beginning ASP.net Databases using
VB.net. In chapter 1
it asks you to do the following, which I did:
1. Install the .NET Framework Sample Databases and Set up the quickstarts
2. Verified under Adminstration Tools/Services that MSSQL$NetSDK is
running.
3. Set up Data Link Properties for (local)\NetSDK, using Windows NT
Integrated Security, and
selected the Northwind database.
4. Went to Server Explorer in VB.net and made a data connection to
Northwind
Everything works fine up to this point.
In chapter three I set up the Virtual Directory BegASPNETdb, downloaded
the samples from the
Wrox web site and placed them under the new directory. The sample is
SQLServer_connection.aspx
which has the following code:
<%@ Import namespace="System.Data" %>
<%@ Import namespace="System.Data.SqlClient" %>
<html>
<head>
<title>Beginning ASP.NET Databases Chapter 3</title>
</head>
<body>
<h4>First Example: Listing data from the Employees table</h4>
<asp:DataGrid id="dgNameList"
runat="server"
Gridlines="None"
BackColor="LightBlue"
CellPadding="5"
CellSpacing="5"
BorderWidth="2"
BorderColor="Black"
ToolTip="Includes only those employees who are at HQ" />
<body>
</html>
<script language="VB" runat="server">
Sub Page_Load(Source As Object, E As EventArgs)
Dim strConnection As String = "server=(local)\NetSDK;
database=Northwind; " & _
"integrated security=true"
Dim objConnection As New SqlConnection(strConnection)
Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
"FROM Employees;"
Dim objCommand As New SqlCommand(strSQL, objConnection)
objConnection.Open()
Response.Write("ServerVersion: " & objConnection.ServerVersion & _
vbCRLF & "Datasource: " & objConnection.DataSource & _
vbCRLF & "Database: " & objConnection.Database)
dgNameList.DataSource = objCommand.ExecuteReader()
dgNameList.DataBind()
objConnection.Close()
End Sub
</script>
When I view the file in IE it only returns the first HTML line "Listing
data from the Employees table."
I'm not getting any errors. It will not display the data from the
Northwind DB.
Any help would be greatly appreciated.
Thanks,
Dan