I’m just trying to use aspx for the first time and I’m getting a
CS1003: Syntax error, ‘(‘ expected
error on line 3.
This is my code:
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="utf-8" %>
<%
using System.Data.Odbc;
// Connection
string connectionString = "Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=db;User=user;password=pass";
OdbcConnection conn = new OdbcConnection(connectionString);
conn.open();
%>
I’m unsure on what is wrong with the ‘using’ line. Any help would be much appreciated.
The contents of a
<% ... %>block are statements that are put inside of theExecutemethod.You can’t put a
usingdirective inside a method.Instead, you need to use the ASP.Net
<%@ Import %>directive: