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>