Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics 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 June 3rd, 2004, 12:37 PM
Registered User
 
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Compilation Error

I'm new to C#, and I'm getting the following error when I try to run the code listed below. When I insert the ';', I recieve another error. Can anyone help? Thanks!

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1002: ; expected

Source Error:
Line 1: <%@ Page Language="C#" %>
Line 2: <script runat = "server">
Line 3: void Page_Load(Object sender, EventArgs e)
Line 4: (
Line 5: OleDbConnection objConnection;
Source File: http://localhost/TestApp2/DataControlMDB.aspx Line: 3

<%@ Page Language="C#" %>
<script runat = "server">
    void Page_Load(Object sender, EventArgs e)
    (
    OleDbConnection objConnection;
    OleDbDataAdapter objCommand;
    String strConnect;
    String strCommand;
    DataSet DatSet1 = new DataSet();

    strConnect = @"Provider = Microsoft.Jet.OLEDB.4.0;";
    strConnect += @"Data Source =P:\DEA\DEAReferenceTraining\ASP.NETC#\Ch02\grocer togo.mdb;";
    strConnect += @"Persist Security Info = false";

    strCommand = "SELECT ProductName, UnitPrice FROM Products";

    objConnection = new OleDbConnection(strConnect);
    objCommand = new OleDBDataAdapter(strCommnand, objConnection);
    DataGrid1.DataSource = DataSet1.Tables("Products").DefaultView;
    DataGrid1.DataBind();
    )
</script>
<html>
<head>
    <title>DataGrid Control example</title>
</head>
<body>
    <asp:DataGrid ID = "DataGrid1" Runat = "server"></asp:DataGrid>
</body>
</html>

 
Old June 3rd, 2004, 01:05 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 184
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jonax
Default

You should use curly braces instead of parenthesis, like this:

Code:
<script runat = "server">
    void Page_Load(Object sender, EventArgs e)
    {
    OleDbConnection objConnection;
...
    DataGrid1.DataBind();
    }
</script>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Compilation Error furqanms Pro Java 2 September 28th, 2007 11:22 AM
compilation error pratik28 C# 1 September 24th, 2006 07:39 AM
Compilation Error allyant ASP.NET 2.0 Basics 1 August 5th, 2006 05:51 PM
Compilation error Giri ASP.NET 1.0 and 1.1 Basics 3 August 3rd, 2005 04:14 PM
compilation error saint Classic ASP Databases 2 June 23rd, 2003 04:08 AM





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