473,378 Members | 1,607 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

script not running

I am running on MS WinXP Pro. I have my virtual directories set up
properly. If i run just a simple "hello world" application it works
fine. i have the following code, which was downloaded from the
internet from the book that i am using, and it worked fine. but then i
transferred to a new computer so i took all the code and transfered it
over. so the page runs up to the <script>. so i tried moving the code
back to the old computer and it gave me the same problem.
any help would be REALLY appreciated.
(the code uses the northwind database which is installed and the
server is running properly as well.)
here's the code:
file: web.config
***
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<customErrors mode="Off" />
<compilation debug="true"/>
</system.web>
</configuration>
***
file: sqlserver_connection.aspx
<%@ 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()
dgNameList.DataSource = objCommand.ExecuteReader()
dgNameList.DataBind()
objConnection.Close()
End Sub
</script>
***
so i know that it is getting to the end of the html tag b/c i put
"hello world" there and it showed up. but the table which is supposed
to show up is not coming up.
any suggestions????
Thank you
Nov 18 '05 #1
1 1205
Well, the first thing I see right away is that in your .aspx file, you don't
have your server controls (dataGrid, etc.) inside of a server form. It
should look like this:

<html>
<head>
<title>Beginning ASP.NET Databases Chapter 3</title>
</head>

<body>
<h4>First Example: Listing data from the Employees table</h4>
<form runat="server" id="Form1">
<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" />
</form>
<body>
</html>


"Sarah" <te*******@aol.com> wrote in message
news:a4**************************@posting.google.c om...
I am running on MS WinXP Pro. I have my virtual directories set up
properly. If i run just a simple "hello world" application it works
fine. i have the following code, which was downloaded from the
internet from the book that i am using, and it worked fine. but then i
transferred to a new computer so i took all the code and transfered it
over. so the page runs up to the <script>. so i tried moving the code
back to the old computer and it gave me the same problem.
any help would be REALLY appreciated.
(the code uses the northwind database which is installed and the
server is running properly as well.)
here's the code:
file: web.config
***
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<customErrors mode="Off" />
<compilation debug="true"/>
</system.web>
</configuration>
***
file: sqlserver_connection.aspx
<%@ 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()
dgNameList.DataSource = objCommand.ExecuteReader()
dgNameList.DataBind()
objConnection.Close()
End Sub
</script>
***
so i know that it is getting to the end of the html tag b/c i put
"hello world" there and it showed up. but the table which is supposed
to show up is not coming up.
any suggestions????
Thank you

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Sticks | last post by:
ok... im not quite sure how to describe my problem. i have a php script that runs through my entire php site and writes the resulting output to html files. this is necessary as the nature of the...
10
by: Doug | last post by:
I have a script that does a huge database update, which takes a long time. However, the host I am running on (and I suspect most hosts) are running in "safe mode." This means I cannot change the...
4
by: Damien Renwick | last post by:
I have a php script which simply stops midway through a while loop that processes records returned by a MySQL query. The HTML page continues trying to load the page but the php has stopped running...
10
by: Larry Neylon | last post by:
Hi All, I want to perform the simple task of running an ASP script as a scheduled job. Previously I've always either run a .vbs script via windows Scheduler, or put some logic in my...
2
by: Benjamin Rutt | last post by:
I often execute a long-running python script which is a "driver" for my application; it may run for several hours on a large input. Under CPython, is it safe for me to modify the Python script...
11
by: Hari Sekhon | last post by:
I have written a script and I would like to ensure that the script is never run more than once at any given time. What is the best way of testing and exiting if there is another version of this...
8
by: Ulysse | last post by:
Hello, I have a python script which runs all the time (using of library threading). I would like this scipt to run on a remote linux Os using Putty. The problem is, when I close Putty command...
5
by: This | last post by:
I have a pretty basic emailing script that sends a relatively small number (150) of html emails. The emails are compiled, personalised from a mysql db subscribers list, and sent using mail() -...
9
by: Scott | last post by:
What is the most reliable method to determine the folder a script is running in? I was looking at the globals in $_SERVER but all the variables also listed the actual file the script was running...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.