Wrox Programmer Forums
|
BOOK: Beginning ASP.NET Databases Also see the forum ASP Databases for more general discussions of ASP database issues not directly related to these books.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 21st, 2004, 03:58 PM
Authorized User
 
Join Date: Jan 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to creative_eye
Default Getting problem in displaying output

I have wrote the program to create the connection with SQL Server. The page executes and doesn't give any error. But it also didn't display the results, the page is blank. The code is this:

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="WebApplication1.WebForm1"%>
<%@ import namespace="System.Data" %>
<%@ import namespace="System.Data.SqlClient" %>

<html>
    <head>
        <title>WebForm1</title>
    </head>
    <body>
        <asp:DataGrid ID=dgNameList Runat=server
                    GridLines="None"
                    BackColor="LightBlue"
                    Cellpadding="5"
                    CellSpacing="5"
                    BorderWidth="2"
                    BorderColor="Black">
        </asp:DataGrid>

    </body>
</html>
<script language=vb runat=server>
    Sub Page_Load(Source As object, E as EventArgs)
        Dim strCon As String = ConfigurationSettings.AppSettings("NWind")
        Dim objCon As New SqlConnection(strCon)
        Dim strSQL = "Select FirstName, LastName, Country " & _
                    "From Employees"
        Dim objCommand As new SqlCommand(strSQL, objCon)

        objCon.Open()
        dgNameList.DataSource = objCommand.ExecuteReader()
        dgNameList.DataBind()
        objCon.Close()
    End Sub
</script>


And in the Web.config file the database connection string is as :

<appSettings>
    <add key="NWind"
        value="Server=(local)\NetSDK; database=Northwind; integrated security=true;">

    </add>
</appSettings>

plz guide me about the problem.






Similar Threads
Thread Thread Starter Forum Replies Last Post
XSL html output problem aiyer0912 XSLT 11 November 8th, 2006 07:19 AM
matching the output and displaying the data ct Excel VBA 0 April 13th, 2006 04:01 AM
problem in the displaying two strings abhit_kumar JSP Basics 0 March 15th, 2005 05:56 AM
Displaying output in Excel via ASP Sach Classic ASP Components 4 May 3rd, 2004 07:37 AM
PDF output problem using XSL pulavarthi XSLT 1 November 6th, 2003 05:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.