Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Error with an ASP.NET code in FrontPage

I am new in Web Design.
I am trying to create a project using ASP.NET, I thought I followed all the procedures to run this project. but when run the project I get a message. I even tried to run a similar project that I got from a book and I get the same message:

An error has occurred on the script in this page.
Line: 17
Char: 37
Error: Expected ')'
Code: 0

NOTE: I open this project with Microsoft FrontPage.
Here is the code for the above error message.
<%@ Page Language="JScript" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Register TagPrefix="Header" TagName="ImageHeader"
Src="imageHeader.ascx" %>

<!-- Fig 23.31: authors.aspx -->
<!-- This page allows a user to choose an -->
<!-- author and display that authors name -->

<html>
<body>
<script language = "JScript" runat = "server">

function Page_Load( sender : Object, events : EventArgs )
{
if ( !IsPostBack )
{
var dataBaseConnection : OleDbConnection = new
OleDbConnection( ConfigurationSettings.AppSettings(
"ConnectionString" ) );

var queryString : System.String =
"SELECT lastName, firstName FROM Authors";

dataBaseConnection.Open();

var dataBaseCommand : OleDbCommand =
new OleDbCommand( queryString, dataBaseConnection );

var dataReader = dataBaseCommand.ExecuteReader();

// while we read a row from result of
// query, add first item to drop down list
while ( dataReader.Read() )
nameList.Items.Add( dataReader.GetString( 0 ) +
", " + dataReader.GetString( 1 ) );

// close database connection
dataBaseConnection.Close();
}
else
{
dataGrid.DataSource = GetData();
dataGrid.DataBind();
}
} // end Page_Load

// Read a database and return the DataView
function GetData() : ICollection
{
var set : DataSet = new DataSet();

// establish a connection, and query the database
var dataBaseConnection: OleDbConnection = new
OleDbConnection( ConfigurationSettings.AppSettings(
"ConnectionString" ) );

var authorID : int = nameList.SelectedIndex + 1;

var queryString : String =
"SELECT Titles.Title, Titles.ISBN, " +
"Publishers.PublisherName FROM AuthorISBN " +
"INNER JOIN Titles ON AuthorISBN.ISBN = " +
"Titles.ISBN, Publishers WHERE " +
"(AuthorISBN.AuthorID = " + authorID + ")";

var dataBaseCommand : OleDbCommand =
new OleDbCommand( queryString, dataBaseConnection );

var dataAdapter : OleDbDataAdapter =
new OleDbDataAdapter( dataBaseCommand );

dataAdapter.Fill( set );

// close database connection
dataBaseCommand.Connection.Close();

var dataView : DataView = new DataView( set.Tables[ 0 ] );
dataView.Sort = "Title";

return dataView;
} // end GetData

</script>

<form runat = "server">

<Header:ImageHeader id = "head" runat = "server">
</Header:ImageHeader>
<br />

Authors:
<asp:DropDownList id = "nameList" runat = "server"
Width = "158px" Height = "22px">
</asp:DropDownList>
<asp:button id = "button" text = "select" runat = "server">
</asp:button>
<p>
<asp:DataGrid id = "dataGrid" runat = "server">
</asp:DataGrid>
</p>

</form>
</body>
</html>

NOTE: this program has a configuration file and register header file, not included here.
[4822 byte] By [anicardoso] at [2007-11-11 10:13:40]