E
Erik H.
I have an ASPX page in which I am trying to bind a datagrid to a dataset
pulled from Microsoft Access DB using code inline method. For some reason,
the compiler is having a problem with 'using'. Any help here would be much
appreciated. Thanks!
Getting the following 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: CS1519: Invalid token 'using' in class, struct, or
interface member declaration
Source Error:
Line 2: <script runat="server">
Line 3:
Line 4: using System.Data;
Line 5: using System.Data.oledb;
Line 6: using System.Web.UI;
My Code:
<%@ Page Language="C#" %>
<script runat="server">
using System.Data;
using System.Data.oledb;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
private void Form_Load(object sender, System.EventArgs e)
{
// create a connection string
string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Dev\ATTRIBUTES_VH\ATTRIBUTES_VH.mdb";
OleDbConnection myConnection = new OleDbConnection();
myConnection.ConnectionString = connString;// create a data adapter
OleDbDataAdapter da = new OleDbDataAdapter("Select * from mytable",
myConnection);
// create a new dataset
DataSet ds = new DataSet();
// fill dataset
da.Fill(ds, "RateCenters");
// Attach DataSet to DataGrid
DataGrid1.DataSource = ds.DefaultViewManager;
DataGrid1.databind()
myConnection.close()
}
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<aspataGrid id="DataGrid1" runat="server"></aspataGrid>
</form>
</body>
</html>
pulled from Microsoft Access DB using code inline method. For some reason,
the compiler is having a problem with 'using'. Any help here would be much
appreciated. Thanks!
Getting the following 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: CS1519: Invalid token 'using' in class, struct, or
interface member declaration
Source Error:
Line 2: <script runat="server">
Line 3:
Line 4: using System.Data;
Line 5: using System.Data.oledb;
Line 6: using System.Web.UI;
My Code:
<%@ Page Language="C#" %>
<script runat="server">
using System.Data;
using System.Data.oledb;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
private void Form_Load(object sender, System.EventArgs e)
{
// create a connection string
string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Dev\ATTRIBUTES_VH\ATTRIBUTES_VH.mdb";
OleDbConnection myConnection = new OleDbConnection();
myConnection.ConnectionString = connString;// create a data adapter
OleDbDataAdapter da = new OleDbDataAdapter("Select * from mytable",
myConnection);
// create a new dataset
DataSet ds = new DataSet();
// fill dataset
da.Fill(ds, "RateCenters");
// Attach DataSet to DataGrid
DataGrid1.DataSource = ds.DefaultViewManager;
DataGrid1.databind()
myConnection.close()
}
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<aspataGrid id="DataGrid1" runat="server"></aspataGrid>
</form>
</body>
</html>